errata

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.

Upload: doanson44

Post on 16-Jan-2016

213 views

Category:

Documents


0 download

DESCRIPTION

Erarta

TRANSCRIPT

Page 1: Errata

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.

Page 2: Errata

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. Thedestructor should be provided to release the memory for the all the dynamically createddata. Here is the destructor:

template

Stack::~Stack()

{

delete [] elements;

}

Chapter 15

Page 453: Replace maxValue("ABC", "ABD") line 22 in Listing 15.1 withmaxValue(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 destructorshould 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:

Page 3: Errata

1. http://cs.armstrong.edu/liang/cpp/Page448.pdf

2. mailto:[email protected]

For the LinkedList class in Listing 16.2, the destructor is missing. The destructor shouldbe provided to release the memory for the all the dynamically created nodes. Here is thedestructor:

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 (AltamahaTechnical College), Ron McCarty (Penn State), Brian Lawson, Dean Kelly (MinnesotaState U.), Caitlin Caldwell (Princeton University), Marcel Manning, the AASU CSCI2490 class of Spring 2007, the AASU CSCI 2490 class of Fall 2007.

Please send errata to [email protected][2]. Thanks for helping improve thebook!