Changes Made from the Second Printing to the Third

Chapter 2

Page

Line

Change

To

52

2nd para.

Replace

In 1989, the American National Standards Institute (ANSI) convened committee X3J16 to establish a standard for the C++ language. This committee was the major contributor to an international effort to standardize C++ under the auspices of the International Standards Organization (ISO) working group WG21. In 1995, a working draft was released for public comment and review. This along with later revised drafts were the principal references for the earlier printings of this text. In November, 1997, a final draft was approved unanimously as the C++ standard. This document (ISO/IEC FDIS 14882) is the basis for this latest revision of this text.

53

Footnote

Replace

1 C++ libraries with names of the form <cxxxx> are actually C libraries. With C++ compilers that are not fully ISO/ANSI compliant, it may be necessary to use their older C names <xxxx.h> – for example, <assert.h> instead of <cassert> – and to make other changes as described in Footnote 1 of Chapter 1.

54

9-11 of Fig. 2.1

iostream.h 
assert.h 
math.h
Insert after line 11:

iostream 
cassert 
cmath
using namespace std;

55

Footnote 2 -- line 2

wchar_t, and

wchar_t, complex, and

59

Footnote 7

Replace

7 Character literals of the form L'x' where x consists of one or more ordinary characters are wide-character literals and are used to represent characters in larger character sets such as Unicode. They are of type wchar_t and have implementation-dependent values.

61

Footnote

Delete

"followed by an uppercase letter or"

63

Last para.

Replace

In addition to programmer-defined constants, C++ provides many predefined constants in its various libraries. For example, the library climits contains 

SHORT_MIN minimum short int value 
SHORT_MAX maximum short int value 
INT_MIN minimum int value 
INT_MAX maximum int value 
UINT_MIN minimum unsigned int value 
UINT_MAX maximum unsigned int value 
LONG_MIN minimum long int value 
LONG_MAX maximum long int value 

64

1T & 9T

float

cfloat

67

Quick Quiz #13

Replace

A named constant declaration begins with the keyword _____ .

78

23-25

iostream.h 
math library 
standard library

iostream 
math library <cmath> 
C standard library <cstdlib>

 

4B

math.h

cmath

 

Footnote

Replace

13 As noted earlier (see Footnote 1), some C++ compilers that are not ISO/ANSI-compliant may use old names for libraries ? e.g., iostream.h, math.h,assert.h, and stdlib.h, instead of iostream, cmath, cassert, and cstdlib, respectively.

79

7T

Delete "whose header file is iostream.h

 

 

8T

iostream

istream

 

10T, 12T

assert 
assert.h

cassert 
cassert

 

8-10B

standard library stdlib 
stdlib.h

standard C library cstdlib 
cstdlib

80

6B

Append

and static_cast<double>(intVal)

 

4B

Append

and static_cast<int>(doubleVal)

 

Last sentence of footnote

Replace

Some C++ compilers that are not ISO/ANSI-compliant may not support these conversion operators.

81

3-5T

Replace

type (expression)
static_cast<type>(expression)  
(type)expression

 

12T

Replace

the last form as (C-style) cast notation.

88

21T

assert library

cassert library

90

First 6 lines of &sect;2.5

Replace

As mentioned in section 2.2, C++ provides the char type for representing character values (and wchar_t for wide characters -- see Footnote 7); also, a char literal consists of a character surrounded by single quotes; and objects of type char can be defined and initialized in a manner similar to int and double objects; for example, 

char myMiddleInitial = 'C';  
const char DIRECTION = 'N';  // N, S, E, or W

91

4T & Table 2.5 caption

ctype

cctype

104

Footnote

Replace

21 The names istream and ostream are the names of two classes (see section 4.3). The ability to develop an entire I/O system using classes provides some indication of their powerful capabilities. The class iostream has also been added to C++ to provide streams that can be used for both input and output. Other i/o classes are ifstream, ofstream, and fstream for streams connected to files (see Chapter 8) and istringstream, ostringstream, and stringstream for streams connected to strings (see Section 8.4).

109

7-8T

Replace

3. The expression endl is evaluated, which inserts a newline character ('\n') into cout and then flushes it, causing output to appear on the screen. The << operator produces the value cout, giving

110

6 of Fig. 2.2

iostream.h 
Insert after this line:

iostream 
using namespace std;

111

5T

Delete return 0;

 

114

4-5 of Fig. 2.3

iostream.h 
iomanip.h 
Inser after line 5:

iostream 
iomanip 
using namespace std;

 

5T

Delete return 0;

 

116

1-3B

iostream.h 
iomanip.h 
assert.h 
Insert at bottom:

iostream 
iomanip 
cassert
using namespace std;

117

last line

3.50

3.65

121

9-10B

taxRate 
interestRate

TAX_RATE 
INTEREST_RATE

 

Changes in Chapter 3