2.2: The cout Object

Ace your homework & exams now with Quizwiz!

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


Related study sets

313 Test, Multiple choice questions

View Set

World History 1 Ch 24. Medieval Civilization & Christianity L 1-10

View Set

Ch 24 Structure and a function of Kidneys

View Set

ELECTRICITY AND ELECTRONICS TRAINING SERIES. MODULE 7-SOLID-STATE DEVICES AND POWER SUPPLIES

View Set

Chapter V: Entrepreneurship & Starting a Small Business

View Set

Microeconomics Ch4- Demand, Supply, and Equilibrium

View Set

ECON 302 - Exam 2 Study Questions

View Set