The errata given here are shown in reverse chronological order from when
I've been notified of the error.
added September 9
The function main in Program 2.4 (page 43) needs
a call of Sides() added after the Eyes() call:
int main()
{
Hair();
Sides(); Sides(); Sides();
Eyes();
Sides(); // the additional line
Ears();
Smile();
Sides(); Sides(); Sides();
return 0;
}
added August 21
Page 236, Exercise 5.8, prototype should be as follows:
int NumDigits(int num);
The int type for the parameter num is missing.
added August 13
The Date class had a bug on PCs and Macs because of
int/long int problem. Only addition of dates and longs were affected,
this is now fixed. An additional operator to subtract two dates was
added to the date class.
Initial posting of errata, August 11, 1997.
page 84, Figure 3.1 both left- and right-hand side,
there is a statement before the call of function Verse:
cin << endl;
that should read
cout << endl;
Page 57, Figure 2.11, the function call
Had(animal) should be HadA(animal): note use
of HadA.
In the Output box at the bottom of page 57, a comma is
missing between hen and everywhere on the last
line. On the first line the second ee-igh should be
capitalized as Ee-igh.
Program 3.1, macinput.cc, on page 83, a variable is
defined as sting noise, this should be string
noise.
On page 91, in the code-fragment explaining / and % at the
top of the page, the number 147 should be replaced by 1347.
On page 103, in the comments that document the file
balloon.h, Program 103, for the function Descend,
replace the word vet with
vent.
For the function GetLocation (page 104) the comment
should read (the word 'many' was missing):
// returns how many cruise "steps" taken
On page 115, in the listing of Program 4.2,
change2.cc, the cout ... statement in function
Output should be terminated by a semi-colon and not a
colon.
Page 138, second to last paragraph, the function
SlicePrice from Program 4.7 is mentioned, this should
be function Cost (the SlicePrice is from Program 3.5,
pizza.cc on page 96).
The program prompt.h (Program 4.11 on page 146) is
labelled as prompt.cc.
In exercise 4.7 on page 156, a discussion of a "boolean
valued int data field" is given. Rather than
an int, a bool data field
should be used and initialized to false instead of 0.
Page 158, on the fifth line up from the bottom, the "0"
should be replaced by "person".
Program 4.16 on page 167 should be labeled as
ctimer.h rather than ctimer.cc.
The output box on page 186 for Program 5.5,
rollsum.cc, shows a prompt that isn't consistent with
the prompt in the program listing. The output box should show:
prompt> rollsum
enter target to roll: 7
number of rolls needed to get 7 = 11
prompt> rollsum
enter target to roll: 7
number of rolls needed to get 7 = 1
In the portion of program 5.10, digits.cc that
appears on page 206, the line
number / 10;
should be
number /= 10;
On page 211, in the comparison of the while loop and the for
loop, the first line of the for loop body is missing, the
complete loop is:
for(; number != 0; number /= 10)
{
digit = number % 10;
s = DigitToString(digit) + " " + s;
}
In the listing of calendar.cc, Program 5.17, on page
247, the literal "Sunday" in the loop at the end
of the function Calendar should be "Saturday",
this is corrected in the online code.
On page 250 at the bottom of the page in the discussion of
calling the member function Absolute, the operator
+= should be replaced by operator ++ since the
implementation of operator += is not shown on this
page.
On page 299, a reference to list.h as given in the
appendix is made. The listing of list.h was removed
prior to printing, the file is accessible from the online program
listings.
In the output box on page 311, the next-to-last line should
not be there.
In Program 9.3, lines.cc on page 439, the first
#include is mistakenly typeset as #included
(note the extra d).
On page 492, the paragraph after the listing of function
Power refers to a call Power(2,21) which
should be Power(3,21) (the 2 should be replaced by a
3).
In the comments from matrix.h reproduced on page
553, there should be a comma after the parameter cols
in the third Matrix constructor (this is in the comment
only).
In the version of bigint.cc originally available on
the web, the roles of parameters lhs and rhs
were reversed. This did not affect the correctness of the code
because + is commutative, but the code wasn't consistent with
other operators. This has been fixed in the code that's online
now.
In the calls to C-style string function strlen in
CPstring.cc (the implementation of the string class used in the
book) compilation warnings will be issued when comparing the
result returned by strlen (which is of type size_t) to
an int. Casting the result returned to an int removes the
warning, this has been done in the online CPstring.cc accessible
from the web pages.