Computing Concepts with C++ Essentials

Book coverBug Report Page

First Edition

Second Edition

Third Edition

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 first 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 second printing is 2

10 9 8 7 6 5 4 3 2

In the third printing, the last number is 3, and so on.

In the errata below, we indicate the edition in which the error has been fixed inside square brackets such as [3].

For example, suppose you have the third printing. Then you can ignore all reports that are prefixed with [3] or [2]. But you would want to pay attention to all reports that are prefixed with [4] or higher or that have no bracketed prefix at all.

Book errata

Page 12

Change "The designers of C were not as competent in language design. Either they did not know about the construction or they did not appreciate its benefits. Instead, they imitated . . . " to "Unfortunately, the designers of C chose to imitate . . . "
[Here is some historical background: C was the successor to B, and B was inspired by BCPL. BCPL had an if . . . do construct, analogous to Algol's if . . . then. B uses the Fortran-like if ( . . . ) instead. B was the invention of Ken Thompson, a demigod and thus beyond criticism by mere mortals :-) He obviously knew of the Algol construct but preferred the Fortran version. He also changed the Algol-style assignment operator := to the Fortran-style = operator, a controversial decision according to Dennis Ritchie.]  

Page 18

Change "tells the compiler that all names that are used in the program belong to the "standard name space"" to "tells the compiler to locate names such as cout in the "standard name space"."

Page 36 Syntax 2.1

Change " . . . << total << \n";" to " . . . << total << "\n";" (i.e. add quotation marks before the backslash). 

Page 36

Change "Names must start with a letter, and the remaining characters must be letters, numbers, or the underscore (_) character." to "Names must start with a letter or the underscore (_) character, and the remaining characters must be letters, numbers, or underscores."

Page 39

Change "double t = p + d * 0.10 + q * 0.25" to "double t = p * 0.01 + d * 0.10 + q * 0.25" (2x)

Page 39 Advanced Topic 2.1

Change "This is because integers are represented using 16 bits,  . . .  a range from –2,147,483,648 to 2,147,483,647." to "This happens when integers are represented using 16 bits, allowing for 216 or 65536, different values. Half of the values (from –1 to –32,768 are negative. There is one less positive value because 0 also needs to be represented.) However, most comonly, integers are represented using 32 bits. Then the inttype has a range from –2,147,483,648 to 2,147,483,647."

Page 56

Change "double t = p + d * 0.10 + q * 0.25" to "double t = p * 0.01 + d * 0.10 + q * 0.25"

Page 62
Change −7 + 4 − 4 = 1 to −7 + 4 + 4 = 1.

[2] Page 70 Exercise R2.1

Change "2ac cos(γ)" to "2abcos(γ)"

[2] Page 76 Exercise P2.18

 Change "setting a value n to 1 if x > 0" to "setting a value n to 1 if x >= 0"

Page 107, Random Fact 3.3

Change " . . .  either out the goodness of their hearts or for self-promotion." to " . . .  either out of the goodness of their hearts or for self-promotion."

Page 164
Add a line
#include <cmath>
at the top of approx.cpp

[2] Page 149 Exercise P4.18

 Remove "See Chapter 8 for more details."

Page 175 global.cpp

Change int p to double p

[2] Page 196 Exercise R5.4

Add {} around the function bodies:

{ return g(x) + sqrt(h(x)); }
{ return 4 * h(x); }
{ return x * x + k(x) - 1; }
{ return 2 * (x + 1); }

Page 202
jul = jul + 1 + jalpha - 0.25 * jalpha;
jul = jul + 1 + jalpha - (int)(0.25 * jalpha);
Page 229
void Employee::set_salary(double new_salary) const
void Employee::set_salary(double new_salary)
Page 242
void remove_message(int i) const;
void remove_message(int i);

Page 265

Change the heading of Quality Tip 7.3 from "Don't use!= to Test the End of a Range" to "Don't use != to Test the End of a Numeric Range".

Page 246 Common Error 7.3
Change "To make the semicolon really stand out, place it on a line by itself, as in the first example." to "You can avoid this error by using an empty block { } instead of an empty statement." (The old advice was correct, but the replacement is an improvement. Thanks to Michael Beeson for pointing this out.)

Page 286

Change "All simulations use essentially the same pattern" to "Many simulations use essentially the same pattern"

Page 312

Line 18 is indented too far. It should line up with line 17.

Page 349

Before the paragraph starting with "Unlike a vector, an array can never change size", add the following paragraph. (This notation is used in Chapter 10.)

Unlike a vector, an array can be filled with values when it is defined. For example,

double salaries[] = { 31000, 24000, 55000, 82000, 49000,
      42000, 35000, 66000, 91000, 60000 };

When you supply initialization values,  you don't need to specify the array size. The compiler determines the size by counting the values.

Page 367 Exercise P9.6

Change "array(s)" to "vector(s)" (5x)

[2] Page 400 Exercise P10.14

Change "Establish the pointers to the beginnings of the lines as a vector<char*>" to "Establish the offsets of the beginnings of the lines as a vector<int>".

Page 404

Change "time: " to "time is " (4x)

Page 405 clocks1.cpp lines 87, 92

Change time: to time is

Page 413 clocks2.cpp lines 130, 135, 140

Change time: to time is

Page 415

Change "time: " to "time is "

Page 417

Change "time: " to "time is "

Page 422 clocks3.cpp line 134

Change time: to time is

Page 423

Change "time: " to "time is " (2x)

Page 429 Exercise R11.7
Change B::B() to B::B() { }

Page 438 Exercise P10.14

Remove the first paragraph: "Finally, the standard cin and cout classes . . . derived from ostream". (The standard now specifies that cin and cout are instances of istream and ostream, and the with_assign classes no longer exist.) 

Page 455

Change "This particular number is not actually a Social Security number belonging to any person. It was printed on sample cards that were inserted in wallets in the 1940s and 1950s" to "This particular number was printed on sample cards that were inserted in wallets. It actually was the social security number of the secretary of a vice president at the wallet manufacturer. When thousands of people used it as their own, the number was voided, and the secretary received a new number."
For more information, see

Page 467

Change "the UML notation that you saw in Chapter 12" to "the UML notation that you saw in Chapter 11"

[2] Page 513 Exercise P13.4

Change "of various colors" to "of various sizes".

Page 597


double vsum = 0;
accumulate(data.begin(), data.end(), vsum);


double vsum = accumulate(data.begin(), data.end(), 0);


double lsum = 0;
accumulate(data.begin(), data.end(), lsum);


double lsum = accumulate(salaries.begin(), salaries.end(), 0);

[2] Page 601 Exercise P16.3


downsize(List& staff)


downsize(list<string>& staff
downsize(list<string>& staff

Page 639

Change const char reason[] to const string& reason (2x)

Page 641 Figure 4

Change arrow from invalid_argument to point to logic_error.

[2] Page 649 Exercise P17.5


a = new char[strlen(s) + 1];
strcpy(a, s)


chars = new char[strlen(s) + 1];
strcpy(chars, s)

[2] Page 650 Exercise P17.6

Change "the add, contains, and size member functions" to "the add, contains, and get_size member functions".

Page 657 and all sample programs in Ch. 26

With newer versions of wxWidgets, the frame should never be initialized in the constructor. It should always be initialized in OnInit:

bool BasicApp::OnInit()
   frame = new wxFrame(NULL, -1, "My First GUI Program");
   return true;

Page 721

Change the heading <strstream> to <sstream>

CCC Code bugs

None yet

Thanks to Love Angel, Tim Budd, Mehmet Canayaz, David L. Clark, Cheryl Gribble, Michael Jepson, John Christopher Jones, Veit Hailperin, Dallas Nutsch, John Potter, George Rypysc, Joshua Shaffer, Catherine Fields Shultz, John Sterling, Wes Kawata, and (your name might go here) for their help!

Please report any remaining bugs in this edition on the bug report form.