2.2: The cout Object
The character escape sequence to represent a double quote is:
\"
The character escape sequence to represent a single quote is:
\'
The character escape sequence to represent a backslash is:
\\
The character escape sequence to force the cursor to go to the next line is:
\n
The character escape sequence to force the cursor to advance forward to the next tab setting is:
\t
Suppose your name was Alan Turing. Write a statement that would print your last name, followed by a comma, followed by your first name. Do not print anything else (that includes blanks).
cout << "Turing,Alan";
Write a statement that prints Hello World to the screen.
cout<<"Hello World";
Write a statement that prints the following to standard output: i= Just write one statement that generates the message above: do not generate any extraneous spaces. Do not declare variables, do not write a main() function, do not write a whole program.
cout<<"i=";
Given an integer variable count, write a statement that writes the value of count to standard output.
cout<<count;
Write a complete program that prints Hello World to the screen.
#include <iostream> using namespace std; int main(){ cout<< "Hello World"; return 0; }
Suppose your name was George Gershwin. Write a complete program that would print your last name, followed by a comma, followed by your first name. Do not print anything else (that includes blanks).
#include <iostream> using namespace std; int main(){ cout << "Gershwin,George"; return 0; }
How many spaces printed out by this statement: cout << "how" << "now" << "brown" << "cow" << "?";
0
How many lines are printed out by this statement: cout << "abc\ndef\tghi\njkl" << endl << endl << "mno\npqr\n";
6