std::string variables for text inputsint variable for the yearstd::cin to get inputsstd::cout to display outputsstd::string variables for text inputsint variable for the yearstd::cin to get inputsstd::cout to display outputsstd::string called title, a std::string called author, and an int called year.Use std::string for text and int for numbers.
std::cout to ask the user to enter the book's title, author, and year. Then use std::getline(std::cin, title) for the title and author, and std::cin >> year for the year to get the inputs.Use std::getline for strings to allow spaces, and std::cin for the integer.
std::cout to print the book's title, author, and year in a clear format. Use multiple std::cout statements or one combined statement.Use std::cout with the << operator to print variables and text.
Title, Author, and Year each on its own line.Make sure your output matches the prompts and labels exactly, including new lines.
Which of the following statements correctly reads two integers a and b from the user in C++?
std::cin is used for input and the extraction operator >> reads values.std::cin >> a >> b; reads two integers from the user correctly.Which of the following lines correctly prints three variables x, y, and z separated by spaces in C++?
std::cout is used for output and the insertion operator << prints values.std::cout << x << ' ' << y << ' ' << z; prints variables separated by spaces correctly.What is the output of the following C++ code if the user inputs 5 10?
int a, b; std::cin >> a >> b; std::cout << a + b << ' ' << a * b << std::endl;
a + b = 15 and a * b = 50 separated by a space.Identify the error in the following C++ code snippet:
int x, y; std::cin << x << y; std::cout << x << y;
std::cin with extraction operator >>, but code uses << which is wrong.std::cout with insertion operator <<.Given the following code, what will be the output if the user inputs 3 4 5?
int a, b, c; std::cin >> a >> b >> c; std::cout << a + b << ' ' << b + c << ' ' << a + c << std::endl;
a + b = 7, b + c = 9, and a + c = 8 separated by spaces.Pass the test and this pattern moves unknown