Errata

This is a list of typographics errors found in H. M. Deitel and P. J. Deitel, C++ How to Program, Prentice-Hall, 1994.

This list was compiled from the 7th printing.

A General Problem

Throughout the sample programs in the text and on the CD-ROM, the authors use a construct like this:
    for (int i = 0; i < limitVal; i++) {
      ...
      }
This code declares the variable i to have block scope within the for loop, which is fine. The problem is that the authors rely on the behavior of older C++ compilers to give i scope that extends from the for statement onward in the function in which it appears, even after the end of the loop. This construct is no longer valid in current drafts of the C++ standard, and the g++ compiler issues warnings when compiling the code.

The general solution is to declare the loop index at the beginning of the function definition instead of inside the for statement.

Errata by Page

Page 134
The quotation should read, "Call me Ishmael."
Page 223
The comment that references "Fig. 3.10" should reference Fig. 3.8.
Page 368
The sentence that begins in the eighth line of the first paragraph in Section 6.11 should start with the word "There" instead of "The."
Page 547
The last sentence of the last full paragraph on the page repeats the last sentence of the previous paragraph. Omit the second copy.
Page 610
The last word of the comment that starts on the seventh line of Fig 12.3 ("elements") appears at the beginning of the next line. It should be at the end of line 7.
Page 620
In the third item in the list of Objectives change the word "of" to "at."
Page 625
In the second line from the bottom of the page, change the word "an" to "and."
Page 673
It's not really a typographical error, but the function textFile should close print.txt before returning. Adding the statement, outPrintFile.close(); just before the last brace in the function would do it.
Page 674
The two functions on this page fail to check the validity of the user's input the way updateRecord() defined on the previous page does. In both functions, the statement cin >> account; should be bracketed by "do { ... } while (account < 1 || account > 100); " The code to issue the prompt should be moved inside this loop.
Page 718
On the first line, change "insertNode" to "insertNodeHelper."
Page 758
The ninth line of text from the top of the page says that value & displayMask evaluates to 1, but it evaluates to 10000000 00000000. However, he logic of the program is correct, because any non-zero value is treated as "true" when C++ evaluates logical expressions.
Page 764
In the "Type" column of Fig. 16.13 change "negation" to "bitwise exclusive OR" or "bitwise XOR."

Christopher Vickery
Queens College of CUNY
Home Page