{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

homework2-Godara

# homework2-Godara - x = 5/2 813978 13 2 cout<<"The...

This preview shows pages 1–3. 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' , '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;

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: x = ( ( 5/2 ) * ( 813978 % 13 ) ) / 2; cout << "The output is : " << x << endl; return 0; } THE NUMBER OUTPUT IS 9 Number Four #include <iostream> using namespace std; void main() { cout << "answer1 is the integer " << 9 / 4 << endl; cout << “answer2 is the integer " << 17 / 3 << endl; } THE NUMBER OUTPUTS ARE 2 AND 5 Number Five #include <iostream> using namespace std; void main() { cout << "The remainder of 9 divided by 4 is " << 9 % 4 << endl; cout << "The remainder of 17 divided by 3 is " << 17 % 3 << endl; } THE NUMBER OUTPUTS ARE 1 AND 2 Number Six #include <iostream> using namespace std; void main() { int num1, num2, num3; double amps1, amps2, amps3; double volts1, volts2, volts3; char codeA, codeB, codeC, codeD; }...
View Full Document

{[ snackBarMessage ]}

### Page1 / 3

homework2-Godara - x = 5/2 813978 13 2 cout<<"The...

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

View Full Document
Ask a homework question - tutors are online