O'Reilly logo

C++ Primer Plus by Stephen Prata

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

J. Answers to Chapter Reviews

Answers to Chapter Review for Chapter 2

1. They are called functions.

2. It causes the contents of the iostream file to be substituted for this directive before final compilation.

3. It makes definitions made in the std namespace available to a program.

4. cout << "Hello, world\n";

or

cout << "Hello, world" << endl;

5. int cheeses;

6. cheeses = 32;

7. cin >> cheeses;

8. cout << "We have " << cheeses << " varieties of cheese\n";

9. The function froop() expects to be called with one argument, which will be type double, and that the function will return a type int value. For instance, it could be used as follows:

int gval = froop(3.14159);

The function rattle() has no return value and expects an int argument. For instance, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required