Introduction To C++ Programming: First Printing Errata (December 20, 2006)

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Introduction to C++ Programming

First Printing Errata (December 20, 2006)


Chapter 2
The titles in Listings 2.1-2.5, should .cpp, not .ccp.
Chapter 3
Page 97: Review Question 3.24, change x to monthlyPayment and y to totalPayment.
Page 85: In the diagram before the Tip, change the first ch is 'c' to ch is 'a'.
Chapter 5
Page 156: The output for Listing 5.15 should be
Page 175: in Exercise 5.8, 105.0 should be 104.0 and 5.44 should be 4.44
Page 176: in Exercise 5.9, 195.721 should be 196.721
Page 178: in Exercise 5.18, 5.2426 should be 4.2426 and 5.4721 should be 4.4721
Chapter 7
Page 232: in line 67 of Listing 7.8, change NUMBER_OF_LETTERS to 26
Page 232: in line 71 of Listing 7.8, change 26 to NUMBER_OF_LETTERS
Chapter 10
Page 341: in Exercise 10.2, change delete "public static" in two places.

Chapter 11
Page 371: in Exercise 11.3, change 3DPoint to ThreeDPoint
Chapter 14
Page 448: missing in the Brief Version. Click here[1] to access it.
For the Stack class in Listing 15.6, ImprovedStack.h, the destructor is missing. The
destructor should be provided to release the memory for the all the dynamically created
data. Here is the destructor:
template
Stack::~Stack()
{
delete [] elements;
}

Chapter 15
Page 453: Replace maxValue("ABC", "ABD") line 22 in Listing 15.1 with
maxValue(string("ABC"), string("ABD")).
Page 455: in Listing 15.2, line 5, remove the extra T.
Chapter 16
For the LinkedList class in Listing 16.2, the destructor is missing. The destructor
should be provided to release the memory for the all the dynamically created nodes.
Here is the destructor:
template<typename T>
LinkedList<T>::~LinkedList()
{
clear();
}

Chapter 18
p521, Example 6 should be replaced by the following code:

For the LinkedList class in Listing 16.2, the destructor is missing. The destructor should
be provided to release the memory for the all the dynamically created nodes. Here is the
destructor:
if (list.contains(e))
{
cout << e << endl;
}
else
for (int i = 0; i < list.getSize(); i++)
{
cout << list.get(i) << endl;
}

Credits: James Chegwidden (Tarrant County College), Mandy Wright (Altamaha


Technical College), Ron McCarty (Penn State), Brian Lawson, Dean Kelly (Minnesota
State U.), Caitlin Caldwell (Princeton University), Marcel Manning, the AASU CSCI
2490 class of Spring 2007, the AASU CSCI 2490 class of Fall 2007.
Please send errata to y.daniel.liang@gmail.com[2]. Thanks for helping improve the
book!
1. http://cs.armstrong.edu/liang/cpp/Page448.pdf
2. mailto:y.daniel.liang@gmail.com

You might also like