You are on page 1of 3

I HEAR I forget. I SEE I remember.

I DO I understand
PROGRAMMING METHODOLOGY: Tutorial 2

Key to the activity done is to ASK QUESTIONS to your lecturer on any part of the tutorial that
you do not understand.

REFER >>>>>>>> https://www.programiz.com/cpp-programming/input-output

Type the code above in your C++ compiler as given. Save the file in your collection by giving it a specific
name. ANSWER the questions below:

#include <iostream>

int main() {
// prints the string enclosed in double quotes
std::cout << "This is C++ Programming";
return 0;
}

1) What was the C++ statement (command) you have to use to produce the output on the display?

>>

2) Why you have to type #include <iostream>?

>>

3) What is the use of // ?

>>

4) Why you have to type std::cout?

>>

5) Why you have to type return 0?


I HEAR I forget. I SEE I remember. I DO I understand
PROGRAMMING METHODOLOGY: Tutorial 2

#include <iostream>
using namespace std;

int main() {
int num1 = 70;
double num2 = 256.783;
char ch = 'A';

cout << num1 << endl; // print integer


cout << num2 << endl; // print double
cout << "character: " << ch << endl; // print char
return 0;
}

1) What is the reason to type using namespace std; ?

>>

2) What is the value assigned to num1?

>>

3) What is the difference between int and double?

>>

4) What is the meaning of char?

>>

5) What does endl do?

>>

6) Provide the coding so that the output of your code will be as shown below:
70
256.783 A

>>

7) Provide the coding so that the output of your code will be as shown below:
140
I HEAR I forget. I SEE I remember. I DO I understand
PROGRAMMING METHODOLOGY: Tutorial 2
256.783
A
>>

8) Provide the coding so that the output of your code will be as shown below:
140 A 256.783
>>

You might also like