Chapter 3

Page 73, line 5 (not counting blank lines) should be

int k\u00F6rper;

Page 89, the line above the Conversions in Expressions heading:

 

replace  2112827392   with   0

 

Page 93, Review Question 2 could be more clearly stated this way:

2. Declare variables matching the following descriptions:

Chapter 4

Page 119, lines 9 and 10: add comment to line 10, indent line 11. Result should look like this:

if (prize.type == 1)             // if statement (Chapter 6)

    cin >> prize.id_val.id_num   // use member name to indicate mode

Page 127, Listing 4.11, Lines 10 and 11 (not counting blank line). Change pi to pt (twice)

cout << "Value of *pt = " << *pt

<< "; Value of pt = " << pt << "\n";

Page 127, second line output from Listing 4.11

Value of *pi

should be

Value of *pt

Page 139, 4th line from the top (not counting blank lines):

pn[0] is the same as pn

should be

pn[0] is the same as *pn

Page 139, line eleven shouldn't be bold and should have *pt:

*pt = 5;         /     // stores the value 5 at that address

NOTE: Both of these line on page 139 were correct when submitted; apparently some formatting program interpreted *p to mean to drop the * and bold the rest of line.

Page 147, end of Listing 4.16; insert a line of code before the return statement:

    delete ps;    // free up allocated memory

    return 0;

Chapter 5

Page 167, sample run at top of page: add one more output line:

Enter a word: animal

lamina

Bye.

Page 196, last line of Compatibility Note:

cin.put(char)   should be   cin.put(char(c))

Chapter 9

Page 383, Listing 9.9 label:

LISTING 9.9  namesp.cpp

should be

LISTING 9.9  namesp.h

Chapter 10

Note: Apparently some formatting program altered the final copy, causing (c) to disappear where ever it appeared in program code. The style sheet used (a), (b), (c), etc. to mark different level headings, so a global remove of the heading levels may have also modified text.

Page 437, Listing 10.12, line 13

toupper != 'Q'  should be  toupper(c) != 'Q'

Page 437, Listing 10.12, line 17

if (!isalpha)  should be   if (!isalpha(c))

Page 438, Listing 10.12 continued, line 4

switch  should be   switch(c)

Chapter 11

Page 450, Listing 11.3, near end:

A = B.Sum;    should be   A = B.Sum(C);

cout <, "B.Sum = ";  should be     cout <, "B.Sum(C) = "

Page 450, Fourth line of output of program:

B.Sum =  should be    B.Sum(C)=

Page 452, Line 7 (not counting blank lines)

A = B.operator+;  should be    A = B.operator+(C):

Page 452, Listing 11.6. The following lines of code

    A = B.operator=;   // function notation

    cout << "A = B.operator+ = ";

should be

    A = B.operator=(C);   // function notation

    cout << "A = B.operator+(C) = ";

Page 453, first line should be

A = B.operator+(C) = 8 hours, 35 minutes

Page 467, middle of the page. Restore the missing (C):

A = B.operator+(C);    // member function

Chapter 12

Page 520, Line 11, not counting blank lines. Another (C) was dropped. The line should be:

A.operator=(B.operator=(C));

Page 520, Line 12, not counting blank lines. Another (C) was dropped. The line begin like this:

Thus, the return value of B.operator=(C) becomes

Chapter 13

Page 583, Listing 13.7, line 4 from bottom (not counting blank lines): Drop the final semicolon:

void ResetRate(double r) { rate = r; };

should be

void ResetRate(double r) { rate = r; }

Page 631. Add the following sentence to the end of the Programming Exercise 3 description:

Add virtual View() methods to the class definitions to handle displaying the data.

Chapter 14

Page 661, the 11th line of code:

B(int m = 0, int n = 0) : A(n) : {b = m; }

should drop the second colon:

B(int m = 0, int n = 0) : A(n) {b = m; }

Page 677, Listing 14.15, ninth line from the bottom:

toupper != 'Q'  should be  toupper(c) != 'Q'

Page 667, Listing  14.15, fifth line from the bottom:

if (!isalpha)  should be   if (!isalpha(c))

Page 678, Listing 14.15 continued, 1st line of code

switch  should be   switch(c)

 

Page 689, next to last line of code Listing 14.20

: a, b(s)     should be     : a(f), b(s)

Page 689, add one more line just before the }; at the bottom of the page of Listing 14.20. The last three lines should look like this (including the correction just given above):

    Pair(const T1 &f, const T2 &s) : a(f), b(s) {}

    Pair() {}

};

Page 708, Programming Exercise 1. Replace the first two sentences with the following:

The Wine class has a String class object member (Chapter 12) holding the name of a wine and a Pair object (this chapter) holding two ArrayDb objects (this chapter). The first ArrayDb object holds a list of vintage years and the second ArrayDb object holds the number of bottles owned for the corresponding vintage year. For example, the first ArrayDb object of the Pair might hold the years 1988, 1992, and 1996, while the second ArrayDb object of the Pair might hold the bottle counts 24, 36, and 48. It may be convenient for Wine to have an int member storing the number of years (3 in the above example).

Page 709, Programming Exercise 2. Replace the first two sentences with the following:

The Wine class has a String class object member (Chapter 12) holding the name of a wine and a Pair object (this chapter) holding two ArrayDb objects (this chapter). The first ArrayDb object holds a list of vintage years and the second ArrayDb object holds the number of bottles owned for the corresponding vintage year. For example, the first ArrayDb object of the Pair might hold the years 1988, 1992, and 1996, while the second ArrayDb object of the Pair might hold the bottle counts 24, 36, and 48. It may be convenient for Wine to have an int member storing the number of years (3 in the above example).

Chapter 15

Page 764, line 8 (not counting blank lines):

Superb pm =       should be    Superb * pm

Page 764, 14th line of code (not counting blank lines): Restore the missing (c) after the ch:

public:

    Magnificent(int h = 0, char c = 'A') : Superb(h), ch(c) {}

Page 768, last line of code: Restore the missing (c) after the ch:

public:

    Magnificent(int h = 0, char c = 'A') : Superb(h), ch(c) {}

Chapter 16

Page 810, next to last line:

Node * p_next;   should be    Node * next;

Page 812, line 17 (not counting blank lines):

for (ar = begin; ar += end; i++, ar++)

should change += to != and should drop the i++,

for (ar = begin; ar != end; ar++)

Appendix D

Page 966

Reposition the row labeled 16 to just after the row labeled 14. Change the 16 to 15 and the 15 in the following row to 16.

Appendix J

Page 1045,  answer to  Chapter 6, RQ 3 should have the output parts in bold. Note the initial $ on line 3 is bold while the rest of the line is not.

Hi!

H$i$!$

$Send $10 or $20 now!

S$e$n$d$ $ct1 = 9, ct2 = 9

Page 1052,  answer to  Chapter 10, RQ 5. the two lines following public: Get rid of the funny arrow symbol on the second line and rearrange the lines this way:

public:

    BankAccount(const char * client = "X", const char * num = "X",

        double bal = 0;)

Page 1052,  answer to  Chapter 10, RQ 7, third line of code:

    strccpy(name, client, 39);

should be

    strncpy(name, client, 39);