Index

Symbols

--, postfix decrement operator 119

--, prefix decrement operator 119

^, beginning of a string (regular expression) 847

^, bitwise exclusive OR operator 719, 876

^=, bitwise exclusive OR assignment operator 727, 828, 876

, comma operator 133

::, binary scope resolution operator 76, 410

::, unary scope resolution operator 207, 875, 882

!, logical NOT 876

!, logical NOT operator 153, 155

!, logical NOT operator truth table 156

!=, inequality operator 35, 427, 876

?, quantifier (0 or 1) 845

?:, ternary conditional operator 99, 219

.*, pointer-to-member operator 880, 881

'', null character 330

' ', newline character 330

[ ] operator for map 789

{n,}, quantifier (at least n) 845

{n,m}, quantifier (between n and m) 845

{n}, quantifier (exactly n) 845

*, multiplication operator 33

*, pointer dereference or indirection operator 293, 294

*, quantifier (0 or more) 845

*=, multiplication assignment operator 118

/, division operator 33

/*  */, C-style multiline comment 25

//, single-line comment 25

/=, division assignment operator 118

', single-quote-character escape sequence 27

", double-quote-character escape sequence 27

\, backslash-character escape sequence 27

a, alert escape sequence 27

d, character class (any decimal digit) 842, 848

D, character class (any non-digit) 842

, newline escape sequence 27

, carriage-return escape sequence 27

S, character class (any non-whitespace character) 842

s, character class (any whitespace character) 842, 848

, tab escape sequence 27

W, character class (any non-word character) 842

w, character class (any word character) 842

& and * operators as inverses 293

& in a parameter list 202

& to declare reference 200

&, address operator 292, 294, 876

&, bitwise AND 719

&& logical AND operator 219

&&, logical AND operator 153, 876

truth table 154

&=, bitwise AND assignment operator 727, 828, 876

#, preprocessor operator 899, 904

##, preprocessor operator 904

%, modulus operator 33

%=, modulus assignment operator 118

+, addition operator 32, 33

+, quantifier (1 or more) 845

++ operator on an iterator 762

++, postfix increment operator 119

++, prefix increment operator 119

+=, addition assignment operator 118, 427, 692

<, less-than operator 35

<<, left-shift operator 719

<<, stream insertion operator 26, 33

<<=, left-shift assignment operator 727

<=, less-than-or-equal-to operator 35

=, assignment operator 32, 33, 156

-=, subtraction assignment operator 118

= =, equality operator 35, 155, 427

>, greater-than operator 35

->, member selection via pointer 882

->*, pointer-to-member operator 880

>=, greater-than-or-equal-to operator 35

>>, right shift operator 719

>>=, right shift with sign extension assignment operator 727

|, bitwise inclusive OR operator 719, 876

| =, bitwise inclusive OR assignment operator 727, 828, 876

| |, logical OR operator 153, 154, 219, 876

truth table 155

~, bitwise complement operator 719, 876

$, end of a string (regular expression) 847

Numerics

0X 616

0x 616

2-D array 265

A

abbreviating assignment expressions 118

abort a program 653

abort function 362, 641, 647, 905

absolute value 168

abstract base class 524, 544, 545, 577

abstract class 544, 545, 546, 564

abstract data type (ADT) 416, 417

abstract operation in the UML 573

access a global variable 207

access function 353

access non-static class data members and member functions 414

access private member of a class 61

access privileges 300, 305

access specifier 53, 60, 371, 398

private 60

protected 344

public 53, 60

access-specifier label

private: 60

public: 53

access structure member 714

access the caller’s data 200

access violation 332, 757

accessing an object’s members through each type of object handle 351

accessor 63

Account class (ATM case study) 45, 86, 89, 123, 222, 282, 283, 285, 287, 377

accounts-receivable file 657

accounts-receivable system 659

accumulate STL algorithm 768, 806, 808, 832, 834

accumulated outputs 32

action 98, 99, 103, 415

action expression in the UML 95, 141, 149, 161

action of an object 160

action oriented 18

action state 95

action state in the UML 161

action state symbol 95

activation in a UML sequence diagram 285

activation record 194

active window 945

activity diagram

do...while statement 141

for statement 135

if statement 98

in the UML 45, 94, 95, 99, 103, 134, 160, 162, 164

sequence statement 95

switch statement 150

activity in the UML 45, 159, 163

activity of a portion of a software system 95

actor in use case in the UML 43

adapter 756, 791

add a new account to a file 686

add an integer to a pointer 312

addition 33, 34

addition assignment operator (+=) 118

addition program that displays the sum of two numbers 30

address (&) of a structure 714

address of a bit field 731

address operator (&) 292, 294, 295, 308, 425, 881

addressable storage unit 732

adjacent_difference STL algorithm 768

adjacent_find STL algorithm 768, 827

ADT (abstract data type) 416

aggregate data type 303, 712

aggregation 88, 350

Agile Software Development 15

aiming a derived-class pointer at a base-class object 534

airline reservation system 669

alert escape sequence ('a') 27, 738

algebraic expression 33

<algorithm> 177

algorithm xxxii, 756, 766, 796, 839

<algorithm> header file 775

algorithms

accumulate 806, 808

binary_search 809, 811

copy_backward 813

count 806, 808

count_if 806, 808

equal 798

equal_range 820, 822

fill 797

fill_n 797

find 809, 811

find_if 809, 811

for_each 806, 809

generate 797

generate_n 797

implace_merge 815

includes 817

inplace_merge 815

insertion sort 263

iter_swap 811, 813

lexicographical_compare 798, 800

lower_bound 820

make_heap 824

max 825

max_element 806, 808

merge 813, 814

min 825

min_element 806, 808

mismatch 798, 800

pop_heap 825

push_heap 824

random_shuffle 806, 808

remove 801

remove_copy 801

remove_copy_if 801, 803

remove_if 801, 803

replace 803

replace_copy 803, 805

replace_copy_if 803, 806

replace_if 803, 805

reverse 813, 815

reverse_copy 815, 817

selection sort 306

set_difference 817, 819

set_intersection 817, 819

set_symmetric_difference 817, 819

set_union 817, 820

sort 809, 811

sort_heap 824

swap 811, 811

swap_ranges 811, 813

transform 806, 809

unique 813, 815

unique_copy 815, 816

upper_bound 820

algorithms copy_backward, merge, unique and reverse 813

algorithms equal, mismatch and lexicographical_compare 799

algorithms fill, fill_n, generate and generate_n 797

algorithms inplace_merge, unique_copy and reverse_copy 815

algorithms lower_bound, upper_bound and equal_range 820

algorithms min and max 825

algorithms of the STL 582

algorithms remove, remove_if, remove_copy and remove_copy_if 801

algorithms replace, replace_if, replace_copy and replace_copy_if 804

algorithms separated from container 767

algorithms swap, iter_swap and swap_ranges 812

alias 202, 203, 293, 707

for a type 760

for the name of an object 366

alignment 714

allocate 408

allocate dynamic memory 648

allocate memory 177, 407

allocator 776

allocator_type 760

alphabetizing strings 337

alter the flow of control 151

ambiguity problem 882, 886

American National Standards Institute (ANSI) 2, 3

American Standard Code for Information Interchange (ASCII) 145, 337

analysis stage of the software life cycle 43

Analysis.cpp 116

Analysis.h 115

analyzing a project’s requirements 19

and operator keyword 876

and_eq operator keyword 876

“ANDed” 722

angle brackets (< and >) 211, 899

angle brackets (< and >) in templates 583

ANSI (American National Standards Institute) 3

ANSI C 8

ANSI/ISO 9899: 1990 3

any method of class bitset 828

Apache Software Foundation 15

append data to a file 660

append method of class string 692

arbitrary range of subscripts 417

argument coercion 174

argument for a macro 901

argument to a function 55

arguments in correct order 172

arguments passed to member-object constructors 391

arithmetic assignment operators 118, 119

arithmetic operator 33

arithmetic overflow 416, 637

arithmetic overflow error 652

arithmetic underflow error 652

“arity” of an operator 427

array 231, 233, 303, 416, 418

name 315, 316

name as a constant pointer to beginning of array 304, 315, 316

notation for accessing elements 316

of pointers to functions 328

of strings 319

subscripting 304, 316

array assignment 417

array bounds 245

array bounds checking 245

Array class 434

Array class definition with overloaded operators 434, 471

Array class member-function and friend function definitions 435

Array class test program 438

array comparison 417

array initializer list 237

array input/output 417

array size 251

array subscript operator ([ ]) 442

arrays and functions 252

arrays passed by reference 254

arrays that know their size 417

array-sort function 582

arrow 95

arrow member selection operator (->) 351, 403

arrowhead in a UML sequence diagram 285

ASCII (American Standard Code for Information Interchange) 145, 330, 337, 604

assert 905

<assert.h> header file 177

assign member function of class string 690

assign member function of list 780

assign one iterator to another 766

assigning a structure to a structure of the same type 714

assigning addresses of base-class and derived-class objects to base-class and derived-class pointers 531

assigning character strings to String objects 455

assigning class objects 369

assignment operator (=) 32, 38, 368, 424, 425, 761

assignment operator functions 444

assignment operators 118

*= multiplication assignment operator 118

/= division assignment operator 118

%= modulus assignment operator 118

+= addition assignment operator 118

-= subtraction assignment operator 118

assignment statement 120

associate from left to right 38, 122

associate from right to left 38, 122, 146

association (in the UML) 18, 86, 88, 89, 373, 374

name 87

associative array 789

associative container 757, 761, 765, 782, 785

associative container functions

count 783

equal_range 785

find 785

insert 785, 789

lower_bound 785

upper_bound 785

associativity 155, 157

associativity not changed by overloading 426

associativity of operators 34, 38

asterisk (*) 33

asynchronous call 284

asynchronous event 638

at member function of class bitset 828

at member function of class string 692, 707

at member function of class vector 280, 776

AT&T 5

ATM (automated teller machine) case study 38, 43

ATM class (ATM case study) 86, 87, 88, 122, 123, 124, 159, 222, 281, 282, 283, 284, 285, 371

ATM system 44, 84, 85, 122, 159, 222, 371

atof function 738, 739

atoi function 738, 739

atol function 738, 739

Attempting to call a multiply inherited function polymorphically 888

attempting to modify a constant pointer to constant data 305

attempting to modify a constant pointer to nonconstant data 304

attempting to modify data through a nonconstant pointer to constant data 303

attribute 18, 58, 373, 374

compartment in a class diagram 124

declaration in the UML 124, 126

in the UML 17, 18, 54, 86, 90, 122, 123, 124, 159, 163, 576

name in the UML 124

attributes of a variable 187

auto keyword 188

auto keyword in C++0x 866

auto storage-class specifier 188

auto_ptr class template 648, 650

auto_ptr object goes out of scope 648

auto_ptr object manages dynamically allocated memory 650

auto_ptr overloaded * operator 650

auto_ptr overloaded -> operator 650

auto_ptr smart pointer 851

automated teller machine 669

automated teller machine (ATM) 38, 43

user interface 39

automatic array 234

automatic array initialization 249

automatic local array 248

automatic local object 362

automatic local variable 188, 191, 204

automatic object 643, 653

automatic storage class 188, 188, 231, 250

automatically destroyed 191

Autos window 952

displaying state of objects 952, 953

displaying the state of localTime 952, 953

average calculation 104, 109

avoid repeating code 359

B

B 3

back member function of class queue 793

back member function of sequence containers 769, 775

back_inserter function template 815, 817

backslash () 27, 902

backslash escape sequence (\) 27

backslash zero 246

backward traversal 706

bad member function 626

bad_alloc exception 644, 646, 647, 651, 776

bad_cast exception 651

bad_exception exception 651

bad_typeid exception 651

bad_weak_ptr exception 856

badbit 661

badbit of stream 605, 626

BalanceInquiry class (ATM case study) 86, 89, 122, 123, 125, 160, 161, 222, 224, 282, 283, 284, 285, 371, 572, 573, 574

Bank account program 680

BankDatabase class (ATM case study) 86, 89, 123, 222, 224, 281, 282, 283, 285, 287, 371, 374

banking system 669

bar chart 240, 242

bar chart printing program 241

bar of asterisks 240, 242

base case(s) 214, 217, 220

base class 475, 476, 478, 573

base-class catch 651

base-class constructor 512

base-class exception 651

base-class member accessibility in derived class 521

base-class pointer to a derived-class object 571

base-class private member 479

base-class subobject 887

base e 168

base specified for a stream 620

base-10 number system 168, 615

base-16 number system 616

base-8 number system 616

base-class initializer syntax 492

base-class member function redefined in a derived class 509

BasePlusCommission-Employee class header file 558

BasePlusCommission-Employee class implementation file 559

BasePlusCommission-Employee class represents an employee who receives a base salary in addition to a commission 487

BasePlusCommission-Employee class test program 489

BasePlusCommission-Employee class that inherits from class CommissionEmployee, which does not provide protected data 507

BasePlusCommission-Employee class that inherits protected data from CommissionEmployee 500

basic searching and sorting algorithms of the Standard Library 809

basic_fstream class template 602, 658

basic_ifstream class template 602, 658

basic_ios class template 601, 887

basic_iostream class template 601, 602, 658, 887

basic_istream class template 600, 658, 887

basic_istringstream class template 707

basic_ofstream class template 602, 658

basic_ostream class template 602, 658, 887

basic_ostringstream class template 707

basic_regex class template 842, 843

basic_string class template 689

BCPL 3

begin iterator 707

begin member function of class string 707

begin member function of containers 759

begin member function of first-class containers 762

beginning of a file 664

beginning of a stream 664

behavior 18, 222, 416

behavior of a system 159, 160, 163, 283

behaviors in the UML 17

bell 27

Bell Laboratories 3

bibliography 9

bidirectional iterator 764, 765, 770, 777, 783, 786, 787, 813, 815, 826

operations 766

bidirectional navigability in the UML 371

binary arithmetic operator 113

binary comparison function 826

binary digit 655

binary function 826, 832, 839

binary function object 832

binary operator 32, 33, 155

binary predicate function 780, 800, 808, 811, 814, 817, 819, 824, 827

binary scope resolution operator (::) 76, 410, 872, 881, 886

binary tree 822

binary_function class 834

binary_search STL algorithm 809, 811, 831

bind1st function 839

bind2nd function 839

bit 655, 712

bit field 719, 728, 730

bit-field manipulation 731

bit-field member of structure 729

bit manipulation 655, 719

bitand operator keyword 876

bitor operator keyword 876

“bits-and-bytes” level 719

<bitset> 176

bitset class 758, 827, 828, 829

flip 829

reset 829

<bitset> header file 760

bitwise AND (&) 719

bitwise AND assignment 876

bitwise AND assignment operator (&=) 727

bitwise AND operator (&) 719, 722

bitwise AND, bitwise inclusive-OR, bitwise exclusive-OR and bitwise complement operators 723

bitwise assignment operator keywords 876

bitwise assignment operators 727, 828

bitwise complement 720, 876

bitwise complement operator (~) 719, 722, 725, 727

bitwise exclusive OR 876

bitwise exclusive OR assignment operator (^=) 727

bitwise exclusive OR operator (^) 719, 722, 725

bitwise inclusive OR 876

bitwise inclusive OR assignment operator (|=) 727

bitwise inclusive OR operator (|) 719, 722, 723, 725

bitwise left-shift operator (<<) 424, 725

bitwise logical OR 828

bitwise operator keywords 876

bitwise operators 719, 720, 727

bitwise right-shift operator (>>) 424

bitwise shift operator 726

block 37, 81, 101, 102, 188, 190, 191

block is active 188

block is exited 188

block of data 748

block of memory 748, 781

block scope 190, 351

variable 351

body of a class definition 53

body of a function 26, 28

body of a loop 103, 130, 134

Booch, Grady 19, 20

bool data type 98

bool value false 98

bool value true 98

boolalpha stream manipulator 156, 623

Boolean attribute in the UML 123

Boost

Array library 839

Bind library 839

Function library 839

mem_fn library 840

Random library 840

Ref library 840

Regex library 841, 842, 848, 868

result_of class template 841

Smart_ptr library 841, 851

Tuple library 841

Type_traits library 842

Boost C++ Libraries xxi, 16, 687, 837

boost namespace 842

Boost Sandbox 838

Boost Software License 838

Boost software license (www.boost.org/more/license_info.html) 838

Boost.Array library 839

Boost.Bind library 839, 864

Boost.Function library 839

cref function 839

function class 840

ref function 839

Boost.mem_fn library 840

Boost.Random library 840

non-deterministic random numbers 840

pseudo-random number generator 840

uniform distribution 840

Boost.Ref library 840

reference_wrapper class template 840

Boost.Regex library 841, 842, 848, 868

basic_regex class 842, 843

format_first_only 850

match_not_dot_newline 844

match_results class 844

regex typedef 843

regex_match algorithm 842, 847

regex_replace algorithm 848, 868

regex_search algorithm 842, 844, 847

regex_token_iterator 848, 850, 868

smatch typedef 844

Boost.Smart_ptr library 841, 851

shared_ptr class 841, 851, 852, 855, 856, 857, 861

weak_ptr class 841, 851, 856

Boost.Tuple library 841

Boost.Type_traits library 842

Borland C++ 209

boundary of a storage unit 730

bounds checking 245

braces ({}) 28, 37, 81, 101, 102, 147

braces in a do...while statement 140

bracket ([ ]) 233

break debugger command 958

break mode 944, 958

break statement 147, 151

break statement exiting a for statement 151

breakpoint 941, 955

disabling 946

inserting 958, 962

yellow arrow in break mode 945

breakpoints

inserting 944, 946

red circle 944

brittle software 503

bucket (hash table) 862

buffer is filled 602

buffer is flushed 602

buffered output 602

buffered standard error stream 600

buffering 628

bug 941

“building blocks” 18

built-in data types 416

built-in type 31

built-in data types 417

business-critical computing 636

byte 655, 719

C

.C extension 6

C legacy code 381, 899, 900, 905

C-like pointer-based array 758

C programming language 862

C99 862

C-style char * strings 704

C-style pointer-based array 796

C-style strings 705

c_str member function of class string 704

C++ 3, 8

C++ compiler 6

C++ development environment 7

C++ environment 7

C++ language 8

C++ preprocessor 6, 26

C++ programming environment 167

C++ programming language 5

C++ resources 23

C++ Standard Library 4, 167

<string> header file 56

class template vector 276

header file location 72

header files 176

string class 56

C++0x xxi, 16, 837, 863

auto keyword 866

char32_t 867

chart16_t 867

conditionally supported behavior 865

delegating constructors 866

extended integer 865

extern template 864

long long integer type 865

right angle brackets 866

rvalue reference 863

sizeof operator 868

static_assert declaration 864

template alias 867

Unicode character 867

variadic template 867

C99 862

calculations 94

call a function 55

call stack 303

calling environment 661

calling function (caller) 53, 62

calling functions by reference 295

camel case 53

capacity member function of string 699

capacity member function of vector 771, 772

capacity of a string 697

card dealing algorithm 324

card games 320

card shuffling and dealing simulation 320, 321, 324, 712, 716, 718

carriage return escape sequence (' ') 27, 732, 736

cascaded assignments 457

cascading += operators 457

cascading member function calls 404, 406

cascading stream insertion operations 32

case label 146, 147

case sensitive 31

case study: Date class 461

case study: String class 447

CashDispenser class (ATM case study) 86, 87, 88, 123, 124, 223, 287

casino 184

<cassert> header file 177, 905

cast 314, 315

downcast 536, 543

cast away const-ness 872

cast expression 902

cast operator 109, 113, 175, 314, 446, 469

cast operator function 446

cast variable visible in debugger 900

catch a base class object 651

catch all exceptions 652

catch handler 635, 637, 643

catch keyword 635

catch related errors 644

catch(...) 652

<cctype> header file 177, 301, 732

CD 655

ceil function 168

cerr (standard error unbuffered) 8, 600, 601, 657

<cfloat> header file 177

chaining stream insertion operations 32

char 31, 145, 175, 704, 719

char ** 740

char16_t 867

char32_t 867

character 655, 712

character array 246, 318, 330, 431, 705

as a string 247

character classes (regular expressions) 842

character code 337

character constant 330

character-handling functions 732, 733

character handling functions isdigit, isalpha, isalnum and isxdigit 733

character handling functions islower, isupper, tolower and toupper 735

character handling functions isspace, iscntrl, ispunct, isprint and isgraph 736

character manipulation 167

character presentation 178

character sequences 669

character set 151, 337, 655

character string 234, 246

character’s numerical representation 145

characters represented as numeric codes 337

character-string manipulation 732

checked access 692

Chinese 416

cin (standard input stream) 8, 31, 32, 600, 601, 657, 661

function getline 332

cin.clear function 627

cin.eof function 605, 626

cin.get function 145, 606

cin.tie function 628

Circle class that inherits from class Point 530

circular include 375

circularly referential data 856

clarity 2

class 4, 17, 18, 125, 222, 226, 371, 900

attribute 58

client-code programmer 77

constructor 65

data member 51, 58

default constructor 65, 68

define a constructor 67

define a member function 52

implementation programmer 77

instance of 60

interface 73

interface described by function prototypes 74

member function 50, 52

member-function implementations in a separate source-code file 75

name 373

naming convention 53

object of 60

public services 73

services 63

class Array 434

class average on a quiz 104

class average problem 104

class bitset and the Sieve of Eratosthenes 829

class definition 52

class development 434

class diagram

for the ATM system model 89, 91

in the UML 45, 86, 89, 122, 124, 223, 224, 371, 374, 574, 575, 576

class diagram (UML) 54

Class DivideByZero-Exception definition 632

class hierarchy 475, 545, 571

class-implementation programmer 77

class keyword 212, 583

class libraries 6, 139

class library 352, 521

class members default to private access 712

class scope 190, 348, 350

class-scope variable is hidden 351

class string 447

class template 582, 586, 689

auto_ptr 648

explicit specialization 594

class-template

definition 587

scope 587

specialization 582, 587

Stack 588, 590

class variable 259

class’s object code 352

class’s source code 352

Classes

auto_ptr 648

binary_function 834

deque 756

exception 632

invalid_argument 652

list 756

runtime_error 632, 643

string 56

vector 275, 466

classic stream libraries 600

clear function of ios_base 627

clear member function of containers 759

clear member function of first-class containers 777

client 420

client code 525

client-code programmer 77

client of a class 18, 222, 284

client of a queue 418

client of an object 51, 63

<climits> header file 177

clog (standard error buffered) 600, 601, 657

close member function of ofstream 662

<cmath> header file 176

<cmath> header 862

coin tossing 178

collaboration 281, 282, 284

collaboration diagram in the UML 45, 283

collaboration in the UML 281

collection classes 418

colon (:) 190, 392, 882

column 265

column headings 234

column subscript 265

combining control statements in two ways 158

comma operator (,) 133, 219, 425

comma-separated list 133, 291

of parameters 172

command-line argument 320

comma-separated list of base classes 882

comment 25

CommissionEmployee class header file 556

CommissionEmployee class implementation file 556

CommissionEmployee class represents an employee paid a percentage of gross sales 481

CommissionEmployee class test program 484

CommissionEmployee class uses member functions to manipulate its private data 504

CommissionEmployee class with protected data 497

Common Programming Error 4

Common Programming Errors overview xxiv

communication diagram in the UML 45, 283, 284

commutative 429

commutative operation 429

comparator function object 783, 787

comparator function object less 783, 795

compare iterators 766

compare member function of class string 694

comparing

blocks of memory 748

strings 692, 693

strings (C-style) 332, 336

compilation unit 875

compile 6

compiler 113

compiler dependent 293

compiling multiple-source-file program 79

compl operator keyword 876

complement operator (~) 719

complex conditions 153

component in the UML 19

component-oriented software development 417

composition 87, 88, 91, 350, 391, 476, 479

compound interest 136

compound interest calculation with for 136, 137

compound statement 37, 101

computing the sum of the elements of an array 240

concatenate 692

concatenate strings 335

concatenated string 457

concatenation of stream insertion operations 32

concept 416

concrete class 544

concrete derived class 548

condition 35, 97, 99, 141, 153

conditional compilation 899, 902

conditional execution of preprocessor directives 899

conditional expression 99, 347, 637

conditional operator (?:) 99

conditional preprocessor directives 902

conditionally compiled output statement 903

conditionally supported behavior 865

confusing assignment (=) and equality (= =) operators 35

confusing equality (= =) and assignment (=) operators 35

confusing equality (= =) and assignment (=) operators 158

conserving memory 188

consistent state 81, 345, 359

const char * 302

const keyword 199, 237, 253, 254, 299, 382, 432, 870, 900

const member function 381

const member function on a const object 383

const member function on a non-const object 383

const object 238, 381, 383

const object must be initialized 238

const objects and const member functions 385

const pointer 276, 434

const qualifier before type specifier in parameter declaration 202

const type qualifier applied to an array parameter 254

const variables must be initialized 238

const version of operator[ ] 445

const with function parameters 299

const_cast operator 870, 871, 878

cast away const-ness 872

const_cast operator demonstration 871

const_iterator 706, 759, 760, 762, 765, 772, 785, 787, 789

const_pointer 760

const_reference 760

const_reverse_iterator 707, 759, 761, 765, 773

constant

floating-point 113

constant integral expression 141, 149

constant pointer 315, 402

to an integer constant 305

to constant data 300, 305

to nonconstant data 300, 304

constant reference 444

constant reference parameter 202

constant variable 237, 239

“const-ness” 878

constructed inside out 394

constructor 65

conversion 446, 455, 471

copy 443

default 68

default arguments 359

defining 67

delegating constructors 866

explicit 471

function prototype 74

in a UML class diagram 69

naming 67

parameter list 67

single argument 446, 455, 470, 472

constructor called recursively 443

constructors and destructors called automatically 362

constructors cannot be virtual 572

constructors cannot specify a return type 65

container xxxii, 176, 756, 757, 796

container adapter 757, 765, 791

container adapter functions

pop 791

push 791

container adapters

priority_queue 795

queue 793

stack 791

container class 353, 418, 442, 582, 593, 758

containers

begin function 759

clear function 759

empty function 759

end function 759

erase function 759

insert function 759

max_size function 759

rbegin function 759

rend function 759

size function 759

swap function 759

Continue command (debugger) 945

continue debugger command 959

continue statement 151

continue statement terminating a single iteration of a for statement 152

control characters 736

control statement 94, 97

nesting 97, 115

repetition statement 97

selection statement 97

sequence statement 97

stacking 97

control statements 97

do...while repetition statement 96, 139, 140, 141

for repetition statement 96, 131, 132

if selection statement 35

nested if...else selection statement 101

switch selection statement 141, 149

while repetition statement 96, 130, 139

control variable 131

control-variable name 132

controlling expression 146

controlling the printing of trailing zeros and decimal points for doubles 616

converge on the base case 220

conversion between a fundamental type and a class 457

conversion constructor 446, 455, 457, 471

conversion operator 446

conversions among fundamental types 446

by cast 447

convert among user-defined types and built-in types 446

convert between types 446

convert lowercase letters 177

Converting a string to uppercase 301

converting from a higher data type to a lower data type 175

converting strings to C-style strings and character arrays 705

copy a string using array notation 318

copy a string using pointer notation 318

copy algorithm 767, 775

“copy-and-paste” approach 491

copy constructor 370, 441, 443, 445, 759, 761

copy constructors in pass-by-value parameter passing 457

copy member function of class string 704

copy of the argument 299

copy_backward algorithm 767, 813

copying strings 318, 333

correct number of arguments 172

correct order of arguments 172

correction 8

correctly initializing and using a constant variable 238

cos function 168

cosine 168

count algorithm 768, 806, 808

count function of associative container 783

count_if algorithm 768, 806, 808

counter 189

counter-controlled repetition 104, 115, 129, 130, 220

counter-controlled repetition with the for statement 131

counting loop 131

cout (standard output stream) 8, 26, 29, 600, 601, 657

cout.put function 603

cout.write function 608

__cplusplus predefined symbolic constant 905

.cpp extension 6

craps simulation 184, 187

create new data types 415, 417

create your own data types 33

CreateAndDestroy class

definition 363

member-function definitions 363

creating a random access file 670

Creating a random-access file with 100 blank records sequentially 674

Creating a sequential file 659

creating an association 791

Credit inquiry program 665

credit processing program 671

cref function 839

<csetjmp> header file 653

<cstdio> header file 178

<cstdlib> header file 176, 178, 647, 738

<cstring> header file 177, 332, 458

<ctime> header file 176, 183

<Ctrl> d 146, 662

Ctrl key 146

<Ctrl> z 146, 614, 662

<ctype.h> header file 177

current position in a stream 664

cursor 27

custom deleter function 851

.cxx extension 6

D

dangerous pointer manipulation 564

dangling-else problem 101

dangling pointer 444, 456

dangling reference 204

data abstraction 381, 415, 434

data function of string 672

data hiding 61, 63

data hierarchy 655, 656

data member 18, 51, 58, 60, 346, 371

private 61

data member function of class string 704

data persistence 655

data representation 416

data structures xxxii, 231, 756

data type 416

data types

bool 98

char 145, 175

double 109, 112, 138

float 109, 175

in the UML 58

int 30

long 150

long double 175

long int 150, 175

short 150

short int 150

unsigned 182

unsigned char 175

unsigned int 175, 182, 309

unsigned long 175

unsigned long int 175

unsigned short 175

unsigned short int 175

database 657

database management system (DBMS) 657

Date class 391, 460

Date class definition 392

Date class definition with overloaded increment operators 461

Date class member function definitions 393

Date class member-function and friend-function definitions 462

Date class test program 464

__DATE__ predefined symbolic constant 904

date source file is compiled 904

DBMS (database management system) 657

deallocate 408

deallocate memory 407, 648

debug 4, 8

debugger 900, 941, 958

Autos window displaying state of objects 952, 953

break command 958

break mode 944, 958, 959

breakpoint 941, 955

Continue command 945

continue command 959

convenience variable (GNU debugger) 960

defined 941, 955

delete command 960

finish command 964

-g compiler option 957

gdb command 958

help command 958

info break command 960

inserting a breakpoint 944

inserting breakpoints 958

Locals window 946

Locals window (Visual C++ 2005 debugger) 947

logic error 941, 955

margin indicator bar 944

debugger (cont.)

next command 965

print command 959

quit command 961

run command 958

set command 962, 963

Solution Configurations combobox 943

step command 964

Step Into command 950

Step Out command 951

Step Over command 950

suspending program execution 946, 962

watch command 966

Watch window (Visual C++) 946, 948

debugging 181

debugging aid 903

debugging tool 905

dec stream manipulator 610, 615, 620

decimal (base 10) number system 741, 742

decimal (base-10) number system 615

decimal digit 655

decimal numbers 620

decimal point 109, 114, 138, 603, 616

decision 98

decision in the UML 161

decision symbol 98

deck of cards 319, 321

declaration 30

of a function 74

using 35

declaring a static member function const 415

decrement

a pointer 312

decrement a control variable 129

decrement operator (--) 119

decrement operators 459

default access mode for class is private 61

default argument 205, 206, 356

default arguments with constructors 356

default case 146, 147, 148, 179, 181

default constructor 65, 68, 356, 396, 441, 443, 461, 591, 759

provided by the compiler 68

provided by the programmer 68

default delimiter 608

default memberwise assignment 369, 425, 761

default memberwise copy 443, 761

default precision 114

default to decimal 620

default to public access 712

defensive programming 133

#define 902, 904

define a constructor 67

Define class GradeBook with a member function displayMessage, create a GradeBook object, and call its displayMessage function 52

Define class GradeBook with a member function that takes a parameter, create a GradeBook object and call its displayMessage function 55

#define NDEBUG 905

#define PI 3.14159 900

#define preprocessor directive 345, 900, 583

defining a member function of a class 52

definition 130

Deitel Buzz Online newsletter 22

[email protected] 3

delete [ ] (dynamic array deallocation) 409

delete a record from a file 686

delete debugger command 960

delete function 851

delete operator 407, 444, 571, 648, 650

deleter function 851

deleting dynamically allocated memory 415

delimiter 332, 338

delimiter (with default value ' ') 606

Demonstrating a mutable data member 879

Demonstrating class template Stack 588, 590

Demonstrating composition—an object with member objects 396

Demonstrating function substr 695

Demonstrating functions erase and replace 702

Demonstrating input from an istringstream object 709

Demonstrating multiple inheritance 883

Demonstrating operator const_cast 871

Demonstrating pre-standard new returning 0 when memory allocation fails 645

Demonstrating string assignment and concatenation 691

Demonstrating the .* and ->* operators 880

Demonstrating the operator keywords 877

Demonstrating the recursive function factorial 216

Demonstrating the string find member functions 699

Demonstrating the string insert functions 703

Demonstrating the use of namespaces 873

Deposit class (ATM case study) 86, 89, 123, 222, 224, 282, 283, 288, 371, 572, 573

DepositSlot class (ATM case study) 86, 87, 88, 123, 223, 283, 372

<deque> header file 176

deque class 756, 768

push_front function 781

<deque> header file 760, 781

deque sequence container 780

dequeue operation 418

dereference

a null pointer 293

a pointer 293, 296, 300

dereference a const iterator 762

dereference an iterator 762, 766

dereference an iterator positioned outside its container 763

dereferencing operator (*) 293

derive one class from another 350

derived class 475, 476, 478, 520, 573

indirect 558

derived-class destructor 571

derived-class catch 651

descriptive words and phrases 122, 124

deserialized object 687

design patterns 15

design process 19, 38, 44, 224, 228

design specification 44

destructor 361, 492, 759

called in reverse order of constructors 362

overloading 362

receives no parameters and returns no value 362

destructor in a derived class 511

destructors called in reverse order 511

developer.intel.com/software/products/compilers/cwin/index.htm 22

diagnostics that aid program debugging 177

diamond inheritance 887

diamond symbol 95, 98

dice game 184

Die-rolling program using an array instead of switch 242

difference_type 761

digit 31, 330

digit (regular expressions) 842

Digital Clock application

Autos window displaying the state of localTime 952

direct base class 475

directly reference a value 290

disabling a breakpoint 946

disk 8

disk drive 599

disk I/O completion 638

disk space 645, 646, 647, 661

displacement 567

display screen 599, 602

DivideByZeroException 637

divides function object 832

division 33, 34

division by zero is undefined 416

do...while repetition statement 96, 139, 140, 141

dollar amount 138

dot operator (.) 54, 351, 403, 538, 650

dotted line 95

double data type 31, 109, 138, 174

double-ended queue 780

double-precision floating-point number 112

double quote 27

double-selection statement 96, 141

double-word boundary 714

“doubly initializing” member objects 397

doubly linked list 758, 777

downcasting 536, 543

download examples from www.deitel.com/books/cppfp/ 2

driver program 69

dummy value 108

duplicate keys 782, 787

DVD 655

dynamic binding 524, 538, 563, 564, 567

dynamic casting 524

dynamic data structure 290

dynamic memory 648

dynamic memory management 407

dynamic_cast operator 570, 651

dynamically allocate array of integers 442

dynamically allocated memory 369, 370, 415, 571, 648

allocate and deallocate storage 362

dynamically allocated storage 443, 447, 456

dynamically creates exact amount of space 397

dynamically determine function to execute 537

E

early classes and objects approach xxi

EBCDIC (Extended Binary Coded Decimal Interchange Code) 337

Eclipse Foundation 15

edit 6

edit phase 8

editing a file 6

editor 6

element of an array 232

elided UML diagram 86

#elif 903

emacs editor 6

embedded parentheses 34

Employee class 391, 397

Employee class definition showing composition 394

Employee class definition with a static data member to track the number of Employee objects in memory 411

Employee class header file 549

Employee class hierarchy driver program 560

Employee class implementation file 550

Employee class member function definitions, including constructor with a member-initializer list 395

Employee class member-function definitions 411

empty exception specification 641

empty function parameter list 198

empty member function

containers 759

priority_queue 795

queue 793

sequence container 776

stack 791

string 468, 699

empty parentheses 53, 54, 57

empty quotation marks 671

empty space 671

empty statement 102

empty string 63, 689, 699

encapsulation 18, 64, 348, 368, 397

end iterator 767

end line 32

end member function

containers 759

first-class container 762

string 707

end of a sequence 811

end of a stream 665

“end of data entry” 108

end-of-file 146, 331, 625, 661

end-of-file indicator 661

end-of-file key combination 661

end-of-file marker 657

#endif preprocessor directive 903, 344

endl stream manipulator 32, 114

enqueue 418

enqueue operation 418

Enter key 32, 146, 148

enum keyword 186

enumeration 186, 900

enumeration constant 186, 902

environment 167

EOF constant 146, 605, 608, 732

eof member function 605, 626, 627

eofbit of stream 625

equal algorithm 768, 798

equal to 35

equal_range algorithm 820, 822

equal_range function of associative container 785

equal_to function object 832

equality and relational operators 36

equality operator 35, 36

!= 153

== 153, 434, 761

erase member function

containers 759

first-class containers 776

string 701, 702

Erroneous attempt to initialize a constant of a built-in data type by assignment 390

#error preprocessor directive 903

error 8

off-by-one 132

error bits 608

error checking 167

error detected in a constructor 643

error message 8

Error-Prevention Tip overview xxiv, 4

error-processing code 631

error state of a stream 605, 625, 626

escape character 27

escape early from a loop 151

escape sequence 27, 29

escape sequences

' (single-quote character) 27

" (double-quote character) 27

\ (backslash character) 27

a (alert) 27

(newline) 27

(carriage return) 27

(tab) 27, 148

event 159

examination-results problem 115

Examples

Accessing an object’s members through each type of object handle 351

Examples (cont.)

Addition program that displays the sum of two numbers 30

Aiming a derived-class pointer at a base-class object 534

Algorithms equal, mismatch and lexicographical_compare 799

Algorithms min and max 825

Algorithms swap, iter_swap and swap_ranges 812

Analysis.cpp 116

Analysis.h 115

Array class definition with overloaded operators 434, 471

Array class member-function and friend-function definitions 435

Array class test program 438

Array of pointers to functions 328

Attempting to call a multiply inherited function polymorphically 888

Attempting to modify a constant pointer to constant data 305

Attempting to modify a constant pointer to nonconstant data 304

Attempting to modify data through a nonconstant pointer to constant data 303

auto_ptr object manages dynamically allocated memory 650

Bank account program 680

Bar chart printing program 241

BasePlusCommission-Employee class header file 558

BasePlusCommission-Employee class implementation file 559

BasePlusCommission-Employee class represents an employee who receives a base salary in addition to a commission 487

BasePlusCommission-Employee class test program 489

Examples (cont.)

BasePlusCommission-Employee class that inherits from class CommissionEmployee, which does not provide protected data 507

BasePlusCommission-Employee class that inherits protected data from CommissionEmployee 500

Basic searching and sorting algorithms of the Standard Library 809

Binary function object 832

Bitwise AND, bitwise inclusive-OR, bitwise exclusive-OR and bitwise complement operators 723

Bitwise shift operators 726

break statement exiting a for statement 151

C++ Standard Library class vector 276

Cascading member function calls 404, 406

Character arrays processed as strings 247

Character-handling functions isdigit, isalpha, isalnum and isxdigit 733

Character-handling functions islower, isupper, tolower and toupper 735

Character-handling functions isspace, iscntrl, ispunct, isprint and isgraph 736

Circle class that inherits from class Point 530

Class bitset and the Sieve of Eratosthenes 829

Class DivideByZero-Exception definition 632

CommissionEmployee class header file 556

CommissionEmployee class implementation file 556

CommissionEmployee class represents an employee paid a percentage of gross sales 481

CommissionEmployee class test program 484

Examples (cont.)

CommissionEmployee class uses member functions to manipulate its private data 504

CommissionEmployee class with protected data 497

Comparing strings 693

Compound interest calculations with for 137

Computing the sum of the elements of an array 240

const objects and const member functions 385

const type qualifier applied to an array parameter 254

const variables must be initialized 238

Constructor with default arguments 359

continue statement terminating a single iteration of a for statement 152

Controlling the printing of trailing zeros and decimal points for doubles 616

Converting a string to uppercase 301

Converting strings to C-style strings and character arrays 705

Correctly initializing and using a constant variable 238

Counter-controlled repetition with the for statement 131

Craps simulation 184

CreateAndDestroy class definition 363

CreateAndDestroy class member-function definitions 363

Creating a random-access file with 100 blank records sequentially 674

Creating a sequential file 659

Creating and manipulating a GradeBook object in which the course name is limited to 25 characters in length 82

Credit inquiry program 665

Date class definition 392

Date class definition with overloaded increment operators 461

Examples (cont.)

Date class member function definitions 393

Date class member-function and friend-function definitions 462

Date class test program 464

Default arguments to a function 205

Default memberwise assignment 369

Define class GradeBook with a member function displayMessage, create a GradeBook object, and call its displayMessage function 52

Define class GradeBook with a member function that takes a parameter, create a GradeBook object and call its displayMessage function 55

Defining and testing class GradeBook with a data member and set and get functions 59

Demonstrating a mutable data member 879

Demonstrating class template Stack 588, 590

Demonstrating composition—an object with member objects 396

Demonstrating copy_backward, merge, unique and reverse 813

Demonstrating function substr 695

Demonstrating functions erase and replace 702

Demonstrating inplace_merge, unique_copy and reverse_copy 815

Demonstrating input from an istringstream object 709

Demonstrating lower_bound, upper_bound and equal_range 820

Demonstrating multiple inheritance 883

Demonstrating operator const_cast 871

Examples (cont.)

Demonstrating pre-standard new returning 0 when memory allocation fails 645

Demonstrating set_new_handler 647

Demonstrating Standard Library functions fill, fill_n, generate and generate_n 797

Demonstrating Standard Library functions remove, remove_if, remove_copy and remove_copy_if 801

Demonstrating Standard Library functions replace, replace_if, replace_copy and replace_copy_if 804

Demonstrating string assignment and concatenation 691

Demonstrating the .* and ->* operators 880

Demonstrating the operator keywords 877

Demonstrating the recursive function factorial 216

Demonstrating the string find member functions 699

Demonstrating the string insert functions 703

Demonstrating the use of namespaces 873

Die-rolling program using an array instead of switch 242

do...while repetition statement 140

Employee class definition showing composition 394

Employee class definition with a static data member to track the number of Employee objects in memory 411

Employee class header file 549

Employee class hierarchy driver program 560

Employee class implementation file 550

Employee class member function definitions, including constructor with a member-initializer list 395

Examples (cont.)

Employee class member-function definitions 411

Equality and relational operators 36

Erroneous attempt to initialize a constant of a built-in data type by assignment 390

Exception-handling example that throws exceptions on attempts to divide by zero 633

flags member function of ios_base 624

Floating-point values displayed in default, scientific and fixed format 622

Friends can access private members of class 399

Functions that take no arguments 197

Generating values to be placed into elements of an array 237

get, put and eof member functions 605

GradeBook class definition containing function prototypes that specify the interface of the class 74

GradeBook class demonstration after separating its interface from its implementation 76

GradeBook.cpp 104, 109

GradeBook.h 104, 109

HourlyEmployee class header file 554

HourlyEmployee class implementation file 554

Implementation class definition 419

Implementing a proxy class 421

Including class GradeBook from file GradeBook.h for use in main 71

Inheritance examples 477

Inheritance hierarchy for university CommunityMembers 477

Initializing a reference 203

Initializing an array’s elements to zeros and printing the array 234

Initializing multidimensional arrays 266

Examples (cont.)

Initializing the elements of an array with a declaration 235

inline function to calculate the volume of a cube 199

Input and output stream iterators 763

Input of a string using cin with stream extraction contrasted with input using cin.get 606

Inputting character data using cin member function getline 607

Instantiating multiple objects of the GradeBook class and using the GradeBook constructor to specify the course name when each GradeBook object is created 66

Integer class definition 649

Interface class definition 420

Interface class member-function definitions 421

Iterative factorial solution 220

Left justification and right justification with stream manipulators left and right 617

Linear search of an array 262

Mathematical algorithms of the Standard Library 806

Member function definitions of class Integer 649

Member initializer used to initialize a constant of a built-in data type 387

Member-function definitions for class GradeBook with a set function that validates the length of data member courseName 80

Memory-handling function memchr 752

Memory-handling function memcmp 751

Memory-handling function memcpy 749

Memory-handling function memmove 750

Memory-handling function memset 752

Multipurpose sorting program using function pointers 325

Examples (cont.)

Name mangling to enable type-safe linkage 210

Nested control statements: Examination-results problem 115

new throwing bad_alloc on failure 646

Non-friend/nonmember functions cannot access private members 400

Overloaded function definitions 208

Overloaded stream insertion and stream extraction operators 430

Pass-by-reference with a pointer argument used to cube a variable’s value 297

Pass-by-value used to cube a variable’s value 296

Passing arguments by value and by reference 201

Passing arrays and individual array elements to functions 252

Point class represents an x-y coordinate pair 528

Pointer operators & and * 294

Poll analysis program 244

Precision of floating-point values 611

Preincrementing and postincrementing 120

Printing a line of text with multiple statements 28

Printing a string one character at a time using a nonconstant pointer to constant data 302

Printing an integer with internal spacing and plus sign 618

Printing an unsigned integer in bits 720

Printing multiple lines of text with a single statement 29

Printing string characteristics 697

Printing the address stored in a char * variable 604

private base-class data cannot be accessed from derived class 492

Programmer-defined maximum function 169

protected base-class data can be accessed from derived class 501

Quantifiers used in regular expressions 845

Examples (cont.)

Randomizing the die-rolling program 182

Reading a random-access file sequentially 678

Reading and printing a sequential file 663

Referencing array elements with the array name and with pointers 316

Regular expression checking birthdays 843

Rethrowing an exception 639

Returning a reference to a private data member 366

Rolling a six-sided die 6000 times 180

SalariedEmployee class header file 552

SalariedEmployee class implementation file 552

SalesPerson class definition 353

SalesPerson class member-function definitions 354

Scoping example 191

Selection sort with call-by-reference 307

Set of recursive calls to method Fibonacci 219

set operations of the Standard Library 817

set_new_handler specifying the function to call when new fails 647

shared_ptr example program. 853

shared_ptrs cause a memory leak in circularly referential data 859

Shifted, scaled integers produced by 1 + rand( ) % 6 179

sizeof operator used to determine standard data type sizes 311

sizeof operator when applied to an array name returns the number of bytes in the array 310

Stack unwinding 642

Standard Library class string 466

Standard Library deque class template 781

Standard Library list class template 777

Standard Library map class template 789

Examples (cont.)

Standard Library multimap class template 788

Standard Library multiset class template 783

Standard Library priority_queue adapter class 795

Standard Library queue adapter class templates 794

Standard Library set class template 786

Standard Library stack adapter class 792

Standard Library vector class template 770

static array initialization and automatic array initialization 249

static data member tracking the number of objects of a class 411, 413

strcat and strncat 335

strcmp and strncmp 336

strcpy and strncpy 334

Stream manipulator showbase 621

Stream manipulators boolalpha and noboolalpha 623

Stream manipulators hex, oct, dec and setbase 610

String class definition with operator overloading 447

String class member-function and friend-function definitions 449

String class test program 452

String copying using array notation and pointer notation 318

String-conversion function atof 739

String-conversion function atoi 740

String-conversion function atol 740

String-conversion function strtod 741

String-conversion function strtol 742

String-conversion function strtoul 742

String-search function strchr 744

String-search function strcspn 745

String-search function strpbrk 746

String-search function strrchr 746

Examples (cont.)

String-search function strspn 747

String-search function strstr 747

strlen 340

strtok 338

Summing integers with the for statement 136

Testing error states 626

Text-printing program 25

this pointer used implicitly and explicitly to access members of an object 402

Time class containing a constructor with default arguments 356

Time class definition 345

Time class definition modified to enable cascaded member-function calls 404

Time class member function definitions, including const member functions 384

Time class member-function definitions 346

Time class member-function definitions including a constructor that takes arguments 357

Time class with const member functions 383

Two-dimensional array manipulations 269

Unary scope resolution operator 207

Unformatted I/O using the read, gcount and write member functions 609

Uninitialized local reference causes a syntax error 203

User-defined, nonparameterized stream manipulators 614

Using a dynamically allocated ostringstream object 708

Using a function template 211

Using an iterator to output a string 706

Using function swap to swap two strings 696

Using member function fill and stream manipulator setfill to change the padding character for fields larger than the values being printed 619

Examples (cont.)

Using member functions get, put and eof 606

Using regex_replace algorithm 849

Using Standard Library functions to perform a heapsort 822

Using stream manipulator uppercase 622

Using template functions 584

Using virtual base classes 889

Utility function demonstration 355

Validating user input with regular expressions 845

vector class template element-manipulation functions 773

weak_ptrs used to prevent memory leak in circularly referential data 861

width member function of class ios_base 613

exception 630

exception class 632, 651

what virtual function 634

exception classes derived from common base class 644

exception handler 635

exception handling 177, 630

Exception-handling example that throws exceptions on attempts to divide by zero 633

<exception> header file 177, 632, 641, 651

exception not listed in exception specification 641

exception object 637

exception parameter 635

exception specification 640

exceptional condition 147

Exception-handling example that throws exceptions on attempts to divide by zero 633

Exceptions

bad_alloc 644

bad_cast 651

bad_exception 651

bad_typeid 651

length_error 652

logic_error 651

out_of_range 652

overflow_error 652

underflow_error 652

executable image 7, 8

execute a program 6, 8

execution-time error 8

execution-time overhead 564

exhaust memory 217

exit a function 28

exit function 363, 647, 653, 661

exp function 168

expand a macro 901

explicit constructor 471

explicit conversion 113

explicit keyword 472

explicit specialization of a class template 594

explicit use of the this pointer 402

exponential “explosion” of calls 220

exponential complexity 220

exponential function 168

exponentiation 138

expression 98, 99, 113, 132, 133

extend the base programming language 417

Extended Binary Coded Decimal Interchange Code (EBCDIC) 337

extended integer 865

extensibility 525

extensibility of C++ 432

extensibility of STL 758

extensible language 20, 54, 217, 246, 417

extensible markup language (XML) 687

extern keyword 189

extern storage-class specifier 188

extern template keyword 864

external declaration 715

F

fabs function 168

face values of cards 320

factorial 214, 215, 217

fail member function 626

failbit of stream 605, 609, 626, 661

false 35, 98, 99, 220, 623

FAQs 23

fatal error 8, 113

fatal runtime error 113

fault-tolerant programs 630

Fibonacci series 217, 219

field 656

field width 139, 234, 609, 612

fields larger than values being printed 619

FIFO (first-in, first-out) 418, 758, 781, 793

file 655, 657, 664

file as a collection of bytes 657

file of n bytes 657

file open mode 660, 662

ios::app 660

ios::ate 660

ios::binary 660, 674, 677

ios::in 660, 662

ios::out 660

ios::trunc 660

file-position pointer 664, 677, 685

__FILE__ predefined symbolic constant 904

file processing 599, 602

file-processing classes 603

file scope 190, 350, 410, 595

filename 660, 662

filename extension

.h 69

filename extensions 6

fill algorithm 767, 797

fill character 347, 609, 612, 618, 619

fill member function 617, 619

fill_n algorithm 768, 797

final state 95

final state in the UML 161

final value of a control variable 129, 134

find algorithm 768, 809, 811

find function of associative container 785

find member function of class string 699, 701

find_each algorithm 768

find_end algorithm 768

find_first_not_of member function of class string 701

find_first_of algorithm 768

find_first_of member function of class string 701

find_if algorithm 768, 809, 811

find_last_of member function of class string 701

finding strings and characters in a string 699

finish debugger command 964

first-class container 756, 760, 761, 764, 773, 777

begin member function 762

clear function 777

end member function 762

erase function 776

first data member of pair 785

first-in, first-out (FIFO) 418, 758, 781, 793

fixed notation 603, 616, 622

fixed-point format 114

fixed-point value 139

fixed stream manipulator 114, 616, 621

fixed word size 416

flag value 108

flags member function of ios_base 624

flash drive 655

flip of bitset 829

float data type 109, 175

<float.h> header file 177

floating point 611, 616, 622

floating-point arithmetic 424

floating-point constant 113

floating-point division 113

floating-point literal

double by default 112

floating-point number 114

double data type 109

double precision 112

float data type 109

single precision 112

floating-point number in scientific format 621

floating-point size limits 177

floating-point values displayed in default, scientific and fixed format 622

floor function 168

flow of control 103

in the if...else statement 99

flow of control of a virtual function call 565

flush buffer 628

flush output buffer 32

flushing stream 609

fmod function 168

fmtflags data type 624

for repetition statement 96, 131, 132

examples 134

for_each algorithm 806, 809

force a decimal point 603

forcing a plus sign 618

form feed ('f') 732, 736

formal parameter 172

formal type parameter 212

format error 626

format of floating-point numbers in scientific format 621

format state 609, 624

format-state stream manipulators 615

format_first_only 850

formatted data file processing 655

formatted I/O 599

formatted input/output 669

formatted text 669

formatting 609

forward class declaration 420

forward declaration 375

forward iterator 764, 770, 806, 811, 813, 815, 826

operations 766

fractional parts 113

fragile software 503

free store 408

friend function 398, 426, 434, 479

friend functions to enhance performance 398

friend keyword 428, 582, 595

friend of a derived class 884

friend of class template 594

friends are not member functions 398

Friends can access private members of class 399

friendship granted, not taken 398

friendship not symmetric 399

friendship not transitive 399

front member function

queue 793

sequence containers 769, 775

front of a queue 418

front_inserter function template 815

fstream 658, 660, 675, 685, 686

<fstream> header file 177, 658

<fstream.h> header file 177

function 8, 18, 26, 173

argument 55

body 53

call 55, 172, 173

declaration 173

definition 58, 172, 190

empty parentheses 53, 54, 57

header 53, 309

local variable 58

multiple parameters 57

name 189, 324

overhead 901

overloading 208, 598

parameter 55, 57

parameter list 57

prototype 74, 138, 173, 174, 190, 200, 296, 398, 900

return a result 62

scope 190

signature 174, 209

function call

operator ( ) 459, 567

overhead 198

overhead] 457

stack 194, 303

function class 840

function object 783, 787, 831, 839

binary 832

divides 832

equal_to 832

greater 832

greater_equal 832

less 832

less_equal 832

less< int > 783

less< T > 787, 795

logical_end 832

logical_not 832

logical_or 832

minus 832

modulus 832

multiplies 832

negate 832

not_equal_to 832

plus 832

predefined in the STL 832

function parameter as a local variable 58

function parameter pack 867

function pointer 324, 564, 567, 832

function prototype

parameter names optional 74

scope 190

semicolon at end 74

function prototype for rand in <cstdlib> 178

function prototype for srand in <cstdlib> 182

function prototype for time in <ctime> 183

function prototypes are mandatory 173

function template 211, 212, 582, 586

function template specialization 211

function that calls itself 213

function that takes no arguments 197

<functional> header file 177, 832, 834

functional structure of a program 28

functions for manipulating data in the standard library containers 177

functions with empty parameter lists 197

function-template definition 583

function-template specialization 582

functor (function object or function) 831

fundamental type 31

G

-g command-line compiler option 957

game of chance 184

game of craps 184

game playing 178

game programming 15

gcc.gnu.org/gcc-4.3/cxx0x_status.html 863

gcc.gnu.org/onlinedocs/libstdc++/ext/tr1.html 839

gcount function of istream 609

gdb command 958

general class average problem 108

general utilities library <cstdlib> 905

generalities 525

generalization in the UML 573

general-utilities library <cstdlib> 738

generate algorithm 768, 797

generate_n algorithm 768, 797

generating values to be placed into elements of an array 237

generator function 797

generic algorithms 767

generic class 587

generic programming 582, 756, 757, 761

get a value 63

get and set functions 63

get member function (cin) 605, 606

get pointer 664

get, put and eof member functions 605

getline function of cin 332, 607

getline function of the string header file 56, 63

getline member function of class string 690

gets the value of 35

global function 167, 594

global function to overload an operator 429

global identifier 872

global namespace 875

global object constructors 362

global scope 364, 875

global variable 189, 190, 191, 193, 207, 251, 875

global, friend function 432

global, non-friend function 426

golden mean 217

golden ratio 217

good function of ios_base 627

Good Programming Practices 4, 8

Good Programming Practices overview xxiv

goodbit of stream 627

goto statement 190

graph information 242

greater function object 832

greater_equal function object 832

greater-than operator 35

greater-than-or-equal-to operator 35

greedy quantifier 845

group of related fields 657

guard condition in the UML 98, 141, 149, 161

guillemets (« and ») in the UML 69

H

.h filename extension 69

.h header file 176

half word 714

handle on an object 350

hard disk 655

hardcopy printer 8

hardware platform 3

has-a relationship (composition) 88, 391, 476

hash function 862

hash table 862

bucket 862

header file 69, 77, 176, 344, 521, 567, 899

location 72

name enclosed in angle brackets 72

name enclosed in quotes (" ") 72

Header files

<exception> 632

<fstream> 658

<iomanip.h> 114

<iostream> 26, 146

<memory> 648

<new.h> 644

<new> 644

<stdexcept> 632, 651

<string> 56

<vector> 276

<algorithm> 775

<deque> 781

<functional> 832

<list> 777

<map> 787, 789

<numeric> 768

<queue> 794, 795

<set> 783

<stack> 791

<typeinfo> 571

heap 408, 795, 822, 825

heapsort 795, 822

heapsort sorting algorithm 822

help debugger command 958

helper function 353

Hewlett-Packard 756

hex stream manipulator 610, 616, 620

hexadecimal 742

integer 293

hexadecimal (base-16) number system 603, 610, 616, 620, 732, 741

hexadecimal notation 603

hide an internal data representation 418

hide implementation details 415, 420

hide names in outer scopes 191

hide private data from clients 353

hiding 397

hierarchy of exception classes 651

hierarchy of shapes 544

high-level I/O 599

highest level of precedence 34

“highest” type 175

horizontal tab (' ') 27, 732, 736

host object 391

HourlyEmployee class header file 554

HourlyEmployee class implementation file 554

I

identifier 31, 96, 190

identifiers for variable names 187

#if preprocessor directive 903

if single-selection statement 35, 96, 98

if single-selection statement activity diagram 98

if...else double-selection statement 96, 98, 99

#ifdef preprocessor directive 903

#ifndef preprocessor directive 344, 903

ifstream 658, 660, 662, 664, 677

ifstream constructor function 662

ignore function of istream 431, 608

Implementation class definition 419

implementation file 420

implementation inheritance 547

implementation of a member function changes 359

implementation phase 577

implementation process 224, 371

Implementing a proxy class 421

implicit compiler-defined conversion between fundamental types 457

implicit conversion 113, 455, 469, 471, 472

via conversion constructors 471

implicit first argument 402

implicit handle 351

implicit pointer 397

implicit, user-defined conversions 455

implicitly virtual 538

imprecision of floating-point numbers 139

improper implicit conversion 470

in-memory formatting 707

in-memory I/O 707

#include "filename" 899

#include <iomanip> 114

#include <iostream> 26

#include preprocessor directive 173, 899

includes algorithm 817

including a header file multiple times 345

increment

a control variable 129, 133, 134

a pointer 312

an iterator 766

increment operator 459

++ 119

indefinite postponement 321

indentation 97, 100

independent software vendor (ISV) 4, 352, 520, 567

index 232

indexed access 781

indirect base class 475, 478

indirect derived class 558

indirection 291

indirection operator (*) 293, 295

indirectly reference a value 290

ineqality operator (!=) 434

inequality 876

inequality operator keywords 876

infinite loop 103, 133, 217

infinite recursion 443

info break debugger command 960

information hiding 18, 307, 415

inherit interface 544

inherit members of an existing class 475

inheritance 17, 344, 350, 475, 478, 520, 567, 572, 573, 575, 576, 577, 582, 796

implementation vs. interface inheritance 547

multiple 882

virtual base class 889

inheritance examples 477

inheritance hierarchy 537, 546

Inheritance hierarchy for university CommunityMembers 477

inheritance relationships of the I/O-related classes 602, 658

initial state in the UML 95, 159, 161

initial value of a control variable 129, 131

initial value of an attribute 124

initialize a constant of a built-in data type 387

initialize a pointer 292

initialize to a consistent state 356

initialize with an assignment statement 389

initializer 235

initializer list 235, 237, 331

initializing a pointer declared const 305

initializing a reference 203

initializing an array’s elements to zeros and printing the array 234

initializing multidimensional arrays 266

initializing the elements of an array with a declaration 235

inline function 198

inline function 353, 791, 794, 795, 900, 902

inline function to calculate the volume of a cube 199

inline keyword 198, 199, 348, 428, 445, 458, 902

inner block 190

inner_product algorithm 768

innermost pair of parentheses 34

inplace_merge algorithm 815

input a line of text 607

Input and output stream iterators 763

input data 8

input from string in memory 177

input iterator 764, 765, 766, 800, 801, 806, 808, 814, 817, 819, 827

input line of text into an array 332

input of a string using cin with stream extraction contrasted with input using cin.get 606

input/output (I/O) 167, 598

input/output library functions 178

input/output of objects 687

input/output operations 95

input/output stream header file <iostream> 26

input sequence 762

input stream 604, 606

input stream iterator 763

input stream object (cin) 29, 31

inputting character data using cin member function getline 607

inputting from strings in memory 707

insert member function

associative container 785, 789

containers 759

sequence container 776

string 703

inserter function template 815

inserting a breakpoint 944

insertion 418

insertion at back of vector 769

insertion sort algorithm 263

instance of a class 60

instant-access application 669

instant access processing 680

instantiated 18

int & 200

int data type 26, 31, 174

int operands promoted to double 113

integer 26, 30

integer arithmetic 424

Integer class definition 649

integer division 33, 113

integer promotion 113

integers prefixed with 0 (octal) 620

integers prefixed with 0x or 0X (hexadecimal) 620

integral size limits 177

integrated case studies xxi

integrity of an internal data structure 418

interaction diagram in the UML 283

interactions among objects 281, 284

interchangeability of arrays and pointers 318

interest rate 137

interface 18, 73, 524

inheritance 547

Interface class definition 420

Interface class member-function definitions 421

interface inheritance 547

interface of a class 73

internal character string 456

internal representation of a string 447

internal spacing 618

internal stream manipulator 615, 618

International Organization for Standardization (ISO) 863

International Standards Organization (ISO) 2, 3

interrupt handler 332

Intranet 5

invalid_argument class 652

invalid_argument exception 776

invoking a non-const member function on a const object 382

<iomanip> header file 176, 600, 610, 900

<iomanip.h> header file 114, 176

ios_base base class 625

ios_base class

precision function 611

width member function 612

ios::app file open mode 660

ios::ate file open mode 660

ios::beg seek direction 664

ios::binary file open mode 660, 674, 677

ios::cur seek direction 664

ios::end seek direction 665

ios::in file open mode 660, 662, 686

ios::out file open mode 660, 686

ios::trunc file open mode 660

<iostream> header file 26, 146, 176, 600, 601, 658, 874, 900

<iostream.h> header file 176

is-a relationship (inheritance) 476, 520, 525, 882, 884

isalnum function 732, 733

isalpha function 732, 733

iscntrl function 733, 736

isdigit function 732, 733, 734

isgraph function 733, 736

islower function 300, 732, 734

ISO (International Organization for Standardization) 2, 863

ISO/IEC C++ Standard xxiii, 9

isprint function 733, 736

ispunct function 733, 736

isspace function 732, 736

istream class 664, 670, 677, 685, 687, 707

peek function 608

seekg function 664

tellg function 665

istream function 602

istream member function ignore 431

istream_iterator 762

istringstream class 707, 709

isupper function 732, 734

ISV 567

isxdigit function 732, 733

iter_swap algorithm 768, 811, 813

iteration 220, 221

Iterative factorial solution 220

iterative model 43

iterative solution 214, 221

<iterator> header file 177, 815, 817

iterator 418, 546, 582, 706, 756

iterator xxxii, 707, 759, 760, 761, 762, 765, 785

iterator class 546

iterator object 418

iterator operations 766

iterator pointing to first element past the end of container 762

iterator pointing to the first element of the container 762

iterator typedef 764

iterator-category hierarchy 764

J

Jacobson, Ivar 19, 20

Japanese 416

Java 5

justified field 619

K

key 782

key/value pair 758, 787, 788

keyboard 8, 31, 145, 148, 599, 602, 658

keyboard input 112

Keypad class (ATM case study) 45, 86, 87, 88, 223, 281, 282, 283, 286, 372

keyword 96, 97

and 876

and_eq 876

auto 188

bitand 876

bitor 876

catch 635

keywords (cont.)

class 212, 583

compl 876

enum 186

explicit 471

extern 189

inline 198, 348

mutable 878

namespace 872, 875

not 876

not_eq 876

or 876

or_eq 876

private 60

public 53, 60

static 189

table of keywords 96

template 583

throw 636

try 634

typedef 601

typename 583

void 53

xor 876

xor_eq 876

keyword const in parameter list of function 199

KIS (“keep it simple”) 8

Koenig, Andrew 630

L

label 190

labels in a switch structure 190

LAMP 15

large object 202

last-in, first-out (LIFO) 193

data structure 758, 791

last-in, first-out (LIFO) order 586, 589

late binding 538

lazy quantifier 845

leading 0 620

leading 0x and leading 0X 620

Lee, Meng 756

left brace ({) 26, 30

left justification 139, 321, 617, 618

left justification and right justification with stream manipulators left and right 617

left shift operator (<<) 424, 601, 719, 725, 726

left side of an assignment 158, 233, 366, 442

left stream manipulator 139, 615, 617

left-to-right associativity 38, 122

left value 158

left-shift assignment operator (<<=) 727

left-to-right evaluation 34

legacy C code 900

legacy code 299, 905

length member function of class string 80, 690

length of a string 246, 331

length of a substring 459

length_error exception 652, 697, 776

less function object 832

less_equal function object 832

less< double > 787

less< int > 783, 787

less-than operator 35, 761

less-than-or-equal-to operator 35

letter 655

lexicographical 694

lexicographical permutator 826

lexicographical_compare algorithm 798, 800

lifeline of an object in a UML sequence diagram 285

LIFO (last-in, first-out) order 193, 586, 589, 758, 791

<limits> header file 178

<limits.h> header file 177

line number 904

line of communication with a file 660, 662

line of text 607

__LINE__ predefined symbolic constant 904

linear search

of an array 262

link 6

link to a class’s object code 352

linkage 187, 875

linked list 418

linker 7

linker error 872

linking 6

Linux 15

shell prompt 9

<list> header file 176

list 791

list class 756, 768

list debugger command 958

list functions

assign 780

merge 780

pop_back 780

pop_front 780

push_front 780

remove 780

sort 780

splice 780

swap 780

unique 780

<list> header file 760, 777

list sequence container 777

live-code approach xxiii, 2

load 6

local automatic object 365

local variable 58, 188, 189, 191

<locale> header file 178

Locals window 946

Locals window (Visual C++ 2005 debugger) 947

lock member function of class weak_ptr 856, 857

log function 168

log10 function 168

logarithm 168

logic error 941, 955

logic_error exception 651

logical AND (&&) operator 153, 722, 876

logical negation 153, 155

logical NOT (!) operator 153, 155, 876

logical operator keywords 876

logical operators 153

logical OR (||) operator 153, 154, 725, 876

logical_and function object 832

logical_not function object 832

logical_or function object 832

long data type 150, 175

long double data type 175

long int data type 150, 175, 215

long long integer type 865

loop 102, 103

loop-continuation condition 129, 131, 132, 134, 139, 141

loop counter 129

loop-continuation condition fails 220

looping statement 102

loss of data 626

lower_bound algorithm 820

lower_bound function of associative container 785

lowercase letter 301, 732, 734

lowercase letters 31, 97, 177

“lowest type” 175

low-level I/O capabilities 599

lvalue (“left value”) 158, 203, 233, 292, 293, 366, 442, 446, 458, 782

lvalues as rvalues 158

M

m-by-n array 265

machine dependent 312, 416

machine language 189

machine-language code 139

Macintosh 614

macro 176, 583

macro argument 901

macro definition 904

macro expansion 901

macro-identifier 901

macros 583, 899

magic numbers 239

magnitude 618

magnitude right justified 615

main function 26, 30

maintenance of software 6

“make your point” 184

make_heap algorithm 824

mandatory function prototypes 173

mangled function name 209

manipulating individual characters 732

manipulator 139

manipulators 658

many-to-one relationship 89

<map> header file 176, 760, 787, 789

mapped values 782

margin indicator bar 944

mask 721

“masked off” 722

match_not_dot_newline 844

match_results class 844

suffix member function of class match_results 844

matching catch block 635

math library 176

math library functions 138, 168

ceil 168

cos 168

exp 168

fabs 168

floor 168

fmod 168

log 168

log10 168

pow 168

sin 168

sqrt 168

tan 168

<math.h> header file 176

mathematical algorithms 806

mathematical algorithms of the Standard Library 806

mathematical calculation 167

mathematical classes 424

max algorithm 825

max_element algorithm 806, 808

max_size member function of a string 699

max_size member function of containers 759

maxheap 822

maximum function 168

maximum length of a string 699

maximum size of a string 697

mem_fun function 840

mem_fun_ref function 840

member function 18, 50, 52, 371

implementation in a separate source-code file 75

member function automatically inlined 348

member-function call 50, 424

member function calls for const objects 382

member function calls often concise 348

member function defined in a class definition 348

Member function definitions of class Integer 649

member functions that take no arguments 348

member initializer 386, 387, 388, 389, 444, 456

member initializer for a const data member 389

member initializer list 882

member-initializer list 388, 391, 395

member-initializer syntax 386

Member initializer used to initialize a constant of a built-in data type 387

member-object initializer 396

member object’s default constructor 396, 397

member selection operator (.) 351, 403, 538, 650

member-function

parameter 55

member-function argument 55

memberwise assignment 368, 425

memberwise copy 443

memchr function 749, 752

memcmp function 749, 751

memcpy function 748, 749

memmove function 748, 750

<memory> header file 177

memory 188

memory access violation 332

memory address 290, 603

memory consumption 564

memory functions of the string-handling library 748

<memory> header file 648

memory leak 408, 648, 650, 705, 757

prevent 650

memory-access violation 757

memory-handling function memchr 752

memory-handling function memcmp 751

memory-handling function memcpy 749

memory-handling function memmove 750

memory-handling function memset 752

memset function 749, 752

menu-driven system 328

merge algorithm 813, 814

merge in the UML 161

merge member function of list 780

merge symbol 103

message 17, 424

message (send to an object) 50

message in the UML 281, 283, 284, 285

message passing in the UML 285

method 18

Microsoft Visual C++ 6, 876

Microsoft Visual C++ home page 22

Microsoft Windows 146

min algorithm 825

min_element algorithm 806, 808

minus function object 832

minus sign (-) indicating private visibility in the UML 371

minus sign, – (UML) 64

mismatch algorithm 768, 798, 800

mission-critical computing 636

mission-critical situation 652

mixed-type expression 175

model of a software system 87, 126, 574

modifiable lvalue 442, 446, 469

modify a constant pointer 304

modify address stored in pointer variable 304

modulus function object 832

modulus operator (%) 33, 34, 178, 183

monetary calculations 139

monetary formats 178

most derived class 891

Mozilla Foundation 15

msdn.microsoft.com/vstudio/express/visualc/default.aspx 22

multidimensional array 265, 266, 268

multimap associative container 787

multiple 33

multiple inheritance 475, 478, 601, 882, 883, 884, 885, 887

multiple inheritance demonstration 883

multiple parameters to a function 57

multiple-selection statement 96, 141

multiple-source-file program

compilation and linking process 77

multiple-statement body 37

multiplication 33, 34

multiplicative operators (*, /, %) 114

multiplicity 86, 87

multiplies function object 832

Multipurpose sorting program using function pointers 325

Musser, David 756

mutable

data member 878

keyword 878

mutable data member 878, 879

mutable demonstration 879

mutable storage-class specifier 188

mutating-sequence algorithms 767

mutator 63

MySQL 15

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset