C++ for Everyone, 2nd Edition

Bug Report Page


How to Tell which Printing You Have

On the copyright page (facing the first page of the Preface), there is a printing history of the book. The printing history is a row of numbers that—at the 1st printing—looks like this:

10 9 8 7 6 5 4 3 2 1

At each subsequent printing, one number is removed from the end of this row of numbers to indicate which printing of the book you have. For example, the last number in the row of numbers in the 2nd printing is 2, and so on. In the list below, [n] means that an error is fixed in the nth printing.

[2] Page 51
In the last row of the table, change the output


[2] Page 65 R2.13
Change “digit” to “digits”
[2] Page 75, 81
Change “Selection operator” to “Conditional operator”
[2] Page 80
Change “When the body of an if statement consists of a single statement” to “When a branch of an if statement consists of a single statement”
[2] Page 83 Syntax 3.2, Page 86 , Page 115 R3.2 and R3.4
Change fabs to abs
[2] Page 187 Self-Check 2
Change “7 years” to “8 years”
[2] Page 241 P5.22

Change “If the first character has a larger value than the second” to “If value(first character) is at least value(second character)”

[2] Page 242
Change “For example, 01100 is  0x7+1x4+1x2+0x1x0x0=6” to “For example, 01100 is  0x7+1x4+1x2+0x1+0x0=6”
[2] Page 265
double NUMBER_OF_SCORES = 10;


const int NUMBER_OF_SCORES = 10;
[2] Page 319
void firstlast(const double a[], int size, double[] result)


void firstlast(const double a[], int size, double result[])
[2] Page 345
After “Write a program that reads lines of text and appends them to a char buffer[1000].”, add: “Read one character at a time by calling cin.get(ch), where ch is a variable of type char. Use input redirection (Special Topic 4.3).”
Page 368 Change the URL http://theory.lcs.mit.edu/~rivest/rsapaper.pdf to http://people.csail.mit.edu/rivest/Rsapaper.pdf
[2] Page 372
At the end of section 8.6.1, add:

Whenever you put data to the stream, the get position becomes undefined. Call seekg when you switch back to reading. Similarly, call seekp when you switch from reading to writing.

[2] Page 375
After line 2, add
#include <string>
[2] Page 376
stream.seekg(start); // Go to the start of the pixels


int pos = start;


int pos = stream.tellg(); // Go to the start of the pixel


stream.seekg(pos); // Go to the next pixel

Add the following into a line after stream.put(red);

pos = pos + 3;

(Why these changes? Some C++ systems are more user-hostile than others and forget the get position when they write data.)

Page 376 ch08/imagemod.cpp
Add this line below stream.seekg(padding, ios::cur); (almost at the end):
pos = pos + padding;
[2] Page 378 R8.5
Change “temp\output.dat or c:emp\output.dat” to “c:\temp\output.dat”.
[2] Page 432 P9.16
Change cctime to ctime
[2] Page 474 R10.16
Change ”subclass” to “derived class”
[2] Page 492
Change “Selection” to “Conditional operator”
[2] Page 495


[2] Web Ch. 14, p. 7 - 8
Change BinarySearchTree; to BinarySearchTree tree; and change tree.add to tree.insert (5x)

Thanks to John K. Estell, Cindy Johnson, Evan Gallagher, Stephen Gilbert, Matthew Lazar, Brent Seales, Paul Sorensen, Jonathan Tolstedt and (your name might go here) for their bug reports and suggestions

Bug Report Form

Please use this form to report any bugs that you find. Please check the list of known bugs and the list of frequently asked questions first before you report a bug. Unfortunately, I do not have the time to respond personally to every report, but I do read them all and will post updates to this page. Thank you!

Your name:

Your email address:

Page number:

Problem description:

To protect against spam robots, please answer this simple math problem:
* =