Chapter 2

1: What are the modules of C++ programs called?
A1: They are called functions.
2: What does the following preprocessor directive do?
#include <iostream>
A2: It causes the contents of the iostream file to be substituted for this directive before final compilation.
3: What does the following statement do?
using namespace std;
A3: It makes definitions made in the std namespace available to a program.
4: What statement would you use to print the phrase “Hello, world” and then start a new line?
A4:
cout << "Hello, world\n";
or
cout << "Hello, world" << endl;
5: What statement would you use to create an integer variable with the name cheeses?
A5:
int cheeses;
6: What statement would you use to assign the value 32 to the variable cheeses ...

Get C++ Primer Plus, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.