Changes Made from the Second Printing to the Third
Chapter 7
Page |
Line |
Change |
To |
387 |
6-7 of Fig. 7.1 |
iostream.h |
iostream |
397 |
6, 7 of Fig. 7.3 |
iostream.h |
iostream |
398 |
16, 19 |
NPOS |
string::npos |
402 |
7, 8 of Fig. 7.5 |
iostream.h |
iostream |
406 |
2B |
Insert before this line: |
#include <cmath> |
413 |
Function in middle of page |
Replace with first version from p. 414. This change along with others on pp. 413-419 results in new layouts of pages e.g., material getting moved forward one page so that new material on namespaces can be added on pp. 418-419. |
char GetMenuChoice(const string & MENU, char firstChoice, char lastChoice) { for (;;) { cout << MENU; char choice; cin >> choice; if (choice >= firstChoice && choice <= lastChoice) break; cerr << "\nI'm sorry, but " << choice << " is not a valid menu choice.\n"; } return choice; // ERROR! } |
|
Footnote |
Replace |
5 There are other rules that govern the scope of identifiers declared in namespaces (later in this section) and classes (see chapter 10). |
415 |
1-2T |
iostream.h |
iostream |
|
23B-22B |
cout , and cerr in iostream.h |
cout , cerr, and clog in iostream |
|
19B and 11B |
iostream.h |
iostream |
|
2B |
cout , and cerr |
cout , cerr, and clog |
416 |
5T |
iostream.h |
iostream |
|
10T |
cout , and cerr |
cout , cerr, and clog |
417 |
17B |
one final rule |
the rule |
419 |
After line 4 |
Insert the following new subsection on namespaces |
|
Namespaces.
One of the recent additions to C++ is the namespace mechanism. If name is declared or defined in a namespace declaration of the formnamespace Something { // declarations and definitions }
then the scope of
name is this namespace block. It can be accessed outside of the namespace only in the following ways:1. By its fully-qualified name
2. By its unqualified name
item, if a using declaration of the formusing namespace Something::name;
or a
usingdirective of the formusing namespace Something;
has already been given, provided that no other item has the same name (in which case qualification is required as described in 1.) A
using directive makes all names in the namespace available. This is why we add the directive using namespace std; after #includes of standard libraries so that the names declared and defined in them can be used without qualification
|
7-16 |
Replace code for the Sum() functions with: |
both named Sum(). |
437 |
5, 6 of Fig. 7.11 |
iostream.h |
iostream |
441 |
6 of Fig. 7.13 |
iostream.h |
iostream |
452 |
8 of Fig. 7.15 |
iostream.h |
iostream |