Identifiers, variables, 42–44
if-else
statements, 75–82, 120–128
Boolean expressions for, 77–79
braces { }
used with, 82, 121–123
branching mechanisms, 75–82, 120–128
comparison operators for, 77–82
compound statements and, 82
dangling else
problem, 121–123
indenting, 120–121, 123–125
multiway branches, 123–128
nested, 120–123
#ifndef
directive, 718–720
ifstream
, 310–311, 320
Implementation files, ADT, 594–599, 710–717, 720–721
Implementation phase, 15
#include
directive, 21, 25–26, 52–53, 184–186, 311, 320, 718–720
C++ programming and, 21, 25–26
directive notation (#
) for, 25
file I/O, 311, 320, 331
header files and, 184–186
#ifndef
directive and, 718–720
manipulator functions and, 331
output and, 52–53
predefined functions and, 186–187
preprocessors for, 186
separate compilation and, 718–720
Increment operators (++), 87–91, 141–144, 962–963, 969–971, 973
Indentation, C++ programming and, 93
Indenting branching statements, 120–121, 123–125
Index (subscript) of arrays, 381, 385–386
Indexed variables, 381–388, 391–393, 428, 433
arguments to functions, as, 391–393
arrays and, 381–388
commas (,
) between, 433
declaration of, 381–386
functions and, 391–393
illegal range of, 385–386
initializing, 388
multidimensional arrays, 428, 433
square brackets [ ]
used for, 380–381, 433
Infinite loop statements, 87–91, 152
Infinite recursion, 801
Information hiding, 205, 599. See also Procedural abstraction
Inheritance, 17, 600–605, 835–894
ancestor class, 846
assignment (=
) operators used for, 862–863
base class, 836, 838–839, 850–852, 860
child class, 602, 836, 846
class hierarchy, 601–602
colon (:
) used for, 602–603
constructors used in, 847–850
copy constructors used in, 862–863
derived classes and, 600–605, 836–838, 839–847, 856–858, 862–863
descendants, 846
destructors and, 862–863
function signature, 859
functions not inherited, 852, 861–862
member functions, 847, 852–854, 855–858
parent class, 602–603, 836, 846
polymorphism and, 864–878
private members and, 850–852
protected
qualifier, 852–854
redefining functions, 855–858
Initialization, 48–49, 145–146, 388, 456–457, 553, 578–585
arrays, 388, 456–457
C strings, 456–457
constructors for, 578–585
declaration and, 48–49
objects, 578–585
structures, 553
variables, 48–49, 145–146, 388, 456–457
Inline functions, 1046
Input, 3, 21–23, 50, 56–58, 157–160, 308–314, 345–351
character data, 345–351
cin
statements for, 21–23, 56–57
computer hardware devices, 3
echoing, 58
extraction operator (>>
) for, 311
get
function, 340–343
loops, design for ending, 157–160
member functions for, 345–350
new_line
( ), 345–347, 349–350
new-line character (\n
) and, 347–348
put
function, 343–344
putback
function, 344–345
reading files, 310–311
streams, 50, 308–314
Input iterators, 974
Input/output (I/O), 50–59, 307–378, 466–468, 477–479, 1040–1041
arguments (parameters) and, 334, 350–351
C++ programming and, 50–59
C strings, 466–468
character, 340–362
cin
(input) statements, 56–57
cout
(output) statements, 50–52
decimal points for formatting numbers, 55–56
designing, 58
double
statements, 55–56
end of files (eof
), 334–337, 355–356
escape sequences, 53–55
files, 308–325, 334–339
flags, 327–329
formatting, 325–340
functions, 325–351, 355–356, 1040–1041
getline
function, 477–478
#include
directive, 52–53
manipulators, 331
namespaces, 52–53, 337–338
new_line
function, 345–346, 348–350
new-line instruction (\n
), 54–55, 58, 342–343, 347–348
predefined character functions, 358–362
streams, 50, 307–378
string
class for, 477–479
using
directive, 52, 337–338
Insertion operator (<<), 312, 318–320, 331, 466, 652–660
in_stream
, 309, 310–311, 314–316, 320
int
, 21, 44, 60–61, 63, 70–72, 116–118, 380–384, 491–493
arithmetic operators and, 70–72
array declaration using, 380–384
Boolean expressions and, 116–118
enumerated types, 119–120
numeric data type, 44, 60–61, 63
unsigned
type, 492–493
value conversion, 116–118
variable declaration using, 21, 44, 380–384, 491–493
vector declaration using, 491–493
Integers, 21, 60–62, 190–192
data values, 60–62
type casting by division, 190–192
variables, 21
Interface files, ADT, 594–595, 707–709, 715, 725, 726
ios::fixed
flag, 327–329
ios::left
flag, 329
ios::right
flag, 329
ios::showpoint
flag, 327–329
ios::showpos
flag, 329
iostream
library, 25
isalpha
function, 361
isdigit
function, 361
islower
function, 361
isspace
function, 360–361
isupper
function, 361
Iterators, 84–87, 157, 159, 757, 804–805, 819–820, 961–975
auto, variable declaration using, 966
bidirectional, 968–971
compiler problems, 966–967
constant, 972–973
decrement operators (––
) for, 969–971
dereferencing (*
) operator for, 966–967
forward, 971
increment operators (++) for, 962–963, 969–971, 973
input, 974
loop mechanisms and, 84–87, 157, 159
mutable, 972
operators for, 962–963
output, 975
pointers as, 757
random access, 968–971
recursion compared to, 804–805
recursive program version, 819–820
reverse, 973–974
templates for, 961–975
types of, 968–973
using
directives for, 961–962
vectors and, 963–967