Professional Documents
Culture Documents
Tut 4
Tut 4
TUTORIAL 4
1. What is missing?
int main() {
<< "Hello World!";
return 0;
}
int main() {
cout << "Hello World! ";
cout << "I am learning C++";
return 0;
}
= ;
4.Display the sum of 5 + 10, using two variables: x and y.
= ;
int y = 10;
cout << x + y;
int x = 5;
int y = 10;
= x + y;
cout << ;
6.Use the correct keyword to get user input, stored in the variable x:
int x;
cout << "Type a number: ";
>> ;
7. Fill in the missing parts to print the sum of two numbers (which is put in by
the user):
int x, y;
int sum;
cout << "Type a number: ";
>> ;
cout << "Type another number: ";
>> ;
sum = x + y;
cout << "Sum is: " << ;
myNum = 9;
myDoubleNum = 8.99;
myLetter = 'A';
myBool = false;
myText = "Hello World";
9. Create two boolean variables, named yay and nay, and add appropriate
values to them:
= ;
= ;
12. Use the correct function to print the length of the txt string.