Recall & Review
beginner
What is
cin used for in C++?cin is used to take input from the user through the keyboard.
Click to reveal answer
beginner
What does
cout do in C++?cout is used to display output on the screen.
Click to reveal answer
beginner
How do you include the library needed for
cin and cout?You include the <iostream> library at the top of your program using #include <iostream>.
Click to reveal answer
beginner
What symbol is used with
cout to send output?The insertion operator << is used to send output to cout.
Click to reveal answer
beginner
How do you read an integer value from the user using
cin?Declare an integer variable, then use cin >> variableName; to read the value.
Click to reveal answer
Which header file must be included to use
cin and cout?✗ Incorrect
cin and cout are part of the iostream library.
What operator is used to get input from the user with
cin?✗ Incorrect
The extraction operator >> is used with cin to read input.
How do you print the text "Hello" using
cout?✗ Incorrect
Use cout << "Hello"; to display text.
What will this code do?<br>
int x; cin >> x;
✗ Incorrect
This code reads a value from the user and stores it in the integer variable x.
Which of these is the correct way to output multiple items?<br>
cout << "Age: " << age << endl;
✗ Incorrect
Using multiple << operators in a row is the correct way to output multiple items.
Explain how to take an integer input from the user and then print it using
cin and cout.Think about the steps from declaring a variable to showing it on screen.
You got /4 concepts.
Describe the role of the operators
>> and << in C++ input and output.Focus on what each operator does with cin and cout.
You got /3 concepts.