Big C++ 2nd Edition

Book coverBug Report Page

Page 67
Replace “Another manipulator, setprecision, is used to set the precision...Combining these three manipulators finally achieves the desired result:” with:

When the next value is displayed, it is padded with spaces so that the total width is 8. For example,

cout << setw(8) << 34.95;



(where each · represents a space).

When lining up currency values, you also need to control the number of digits after the decimal point. For example, you want 34.5 to display as 34.50 and 34.249997 as 34.25.

Another pair of manipulators, fixed and setprecision, is used for this purpose.

The command

cout << fixed << setprecision(2);

ensures that subsequent floating-point numbers are printed with two digits after the decimal point.

Combining these three manipulators achieves the desired result:

Page 100, 104, 105
Change “Selection operator” to “Conditional operator”
Page 108
In Common Error 3.2, add absolute value | | around x - y in the second equation.
Page 261
void get_name() const;
void get_age() const;


string get_name() const;
int get_age() const;
Page 264
Change “A constructor with a weight and an x-position (the y-position is initially 0)” to “A constructor with an x-position (the y-position is initially 0)”
Page 302 Exercise P6.18
Remove “or if you are in the lower-right corner,”
Page 340 Exercise P7.17
void fill_with_values(int[] a, int size, IntFunPointer f)


void fill_with_values(int a[], int size, IntFunPointer f)
Page 395
Before “If you want to manipulate a data set in a file,” add a paragraph

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.

Page 406 Exercise P9.9
Change “Set a variable first to 1, last to nrecords.” to “Set a variable first to 0, last to nrecords - 1.”
Page 406 Exercise P9.10
Change "\n" to '\n'
Page 439 Exercise P10.2
Sentence greeting = new Sentence("Hello!");


Sentence greeting("Hello!");
Page 503 Exercise P12.16
Change “just like in the standard stack template” to “just like in the standard queue template”.
Page 511
Change tree.add to tree.insert (5x)
Page 536
Add semicolons after lines 50, 57, 64, 71, 78, 85
Page 542 Exercise P13.6
Change string smallest() to string smallest() const
Page 542 Exercise P13.9
Change void act(string str) { } to virtual void act(string str) { }
Page 543 Exercise P13.12
Change “If the current node is the left child of the parent, move to the parent. Otherwise, go to the right child if there is one, or to the leftmost descendant of the next unvisited parent otherwise.” to “If the current node has a right child, then go to the leftmost leaf of the right child. Otherwise keep moving up to the parent until the previously traversed node is a left child.”
Page 587 Exercise P15.2
Change “Modify the conversion operator double so that it will produce the value zero in this case. Finally, add a conversion” to “Add a conversion”
Page 623
SharedString& operator=(const SharedString&);


SharedString& operator=(const SharedString& right);
Page 640 Exercise P15.9
Remove “a Boolean field and”
Page 695 Exercse P17.2
Change is_empty to empty
Page 799 Exercise P20.2
Change “Extend the analysis to 50 consecutive push_back operations and see if the trends identified in Section 12.3 continue. Next, perform the same analysis for 12 operations, but assume the buffer has an initial capacity for 10 elements.” to “Print the average number of assignments to the buffer for 50 consecutive push_back operations and an initial buffer size of 0. Repeat for 12 push_back operations and an initial buffer size of 10.”
Page 808 Syntax 21.2
The line decltype(variable_name) variable_name = initial_value; should end in a semicolon, not a colon
Page 819 Syntax 21.10
class Box
   Box(T int) { value = init; }
   T value;


class Accumulator
   Accumulator() { result = 0; }
   void add(T value) { result = result + value; }
   T get_result() { return result; }
   T result;
Page 966
Change “Selection” to “Conditional operator”
Page 998
Remove (<<),  (>>) and (>>>) in the captions of Figure 1.

Thanks to David Ardia, Gabriela Ernsberger, Evan Gallagher, Stephen Gilbert, Russell Howes, Cindy Johnson, Kurt Schmidt, Brent Seales, Gwen Walton, René Witte, and (your name might go here) for their help!

Bug Report Form

Please use this form to report any bugs that you find. 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:
* =