Chapter 2


1.

How do you cause the cursor to move to the next line when performing screen output?

using the \n escape key

2.

What does the escape key \b do?

causes a backspace

3.

How would you direct input from the keyboard to a variable called amountentered?

 cin -- amountentered;

4.

To use cin, you must import what file?

 # include - iostream.h -

5.

Is this statement/expression correct:

cout>> "Hello World";

no, the arrows (--) point the wrong way.

6.

What does the escape key \t do?

causes a horizontal tab

7.

How would you output a literal text such as “The answer is” and the variable that holds the answer (let’s call it answer) on the same line?

 cout -- `the answer is ` -- answer;

8.

How would you create a new line if you were writing code in C instead of C++?

the same way as c++. the escape characters work the same in both languages.

9.

How would you put literal quotes in your output?

you would use the \` escape character.

10.

What is the purpose of the setf function?

it sets the flags for formatting output.

Answers

1.

Using the \n escape key

2.

Causes a backspace

3.

cin >> amountentered;

4.

# include <iostream.h>

5.

No, the arrows (>>) point the wrong way.

6.

Causes a horizontal tab

7.

cout << "the answer is " << answer;

8.

The same way as C++. The escape characters work the same in both languages.

9.

You would use the \" escape character.

10.

It sets the flags for formatting output.




C++ Programming Fundamentals
C++ Programming Fundamentals (Cyberrookies)
ISBN: 1584502371
EAN: 2147483647
Year: 2005
Pages: 197
Authors: Chuck Easttom

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net