Tanuj Godara Lab 2

Tanuj Godara Lab 2 -...

This preview shows pages 1–2. Sign up to view the full content.

Tanuj Godara 9052-79307 In-Lab Questions Number 1 #include <iostream> using std::cout; int main() { int x; //introduces a new integer x int y = 9; //introduces an integer y, which represents the number 9 double a = 4.7; //introduces a double, which can have decimal places. cout << a << "\n" ; //outputs "a," and then makes a new line. cout << (x = y) //sets x equal to y, and then skips two lines. << "\n\n" ; return 2; //returns it to the function } Number Two #include <iostream> using namespace std; int main() { const int a = 1024 ; char arr[a] = { 'p'

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: , 'd' , 'j' , 'q' , 'h' , 'w' , 'l' , 'f' , '#' , 'i' , 'l' , 'h' , 'o' , 'g' , '#' , 'g' , 'h' , 'w' , 'h' , 'f' , 'w' , 'h' , 'g' , '1' , '\0' }; for ( int a = 0; a <24; a++){ arr[a] = arr[a] - 3; } cout << arr << endl; return 0; } THE MESSAGE IS “magnetic field detected.” Number Three #include <iostream> using namespace std; int main() { double x; x = ( ( 5/2 ) * ( 813978 % 13 ) ) / 2; cout << "The output is : " << x << endl; return 0; } THE NUMBER OUTPUT IS 9...
View Full Document

{[ snackBarMessage ]}

Page1 / 2

Tanuj Godara Lab 2 -...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online