that use n copies of character, 1257
that use parts of arrays, 1254–1255
that use ranges, 1257
string1.cpp, 653–656
string1.h, 653
StringBad class, 628
constructors, 632–633
destructor, 633
strngbad.cpp, 630–631
strngbad.h, 628–629
vegnews.cpp sample program, 633–637
strings
accessing, 1259
accessing with for loops, 206–207
appending, 1265–1266
assigning, 1266
C-style, 120–122
combining with numeric input, 130–131
concatenating, 122
empty lines, 130
failbits, 130
in arrays, 123–124
null characters, 121
passing as arguments, 339–341
pointers, 173–178
returning from functions, 341–343
string input, entering, 124–126
string input, reading with get(), 127–130
string input, reading with getline(), 126–127
comparing, 1263–1265
C-style strings, 220–223
string class strings, 223–224
concatenating, 128, 1266
copying, 1269
erasing, 1267–1268
initializing, 121
input, 1106–1108
input/output, 1269–1270
inserting, 1267
palindromes, 1057
replacing, 1268–1269
searching, 1260
find_first_not_of() method, 1262–1263
find_first_of() method, 1262
find_last_not_of() method, 1263
find_last_of() method, 1262
find() method, 1260–1261
rfind() method, 1261
string access methods, 1259
string class, 131–133, 647, 960, 966, 1249–1250, 1333
append methods, 1265–1266
appending, 133–134
assignment, 133–134
assignment methods, 1260, 1266
assignment operator, overloading, 652–658
automatic sizing, 966–967
bracket notation, 649–651
comparing, 960
comparison members, 648–649
comparison methods, 1263–1265
complex operations, 135–136
concatenation, 133–134
concatenation methods, 1266
constants, 1251
constructors, 952–956, 1253–1257
copy methods, 1269
data methods, 1251–1253
default constructor, 647–648
erase methods, 1267–1268
finding size of, 960
Hangman sample program, 962–965
input, 957–960
input/output, 1269–1270
insertion methods, 1267
memory-related methods, 1258
reading line by line, 136–140
replacement methods, 1268–1269
search methods, 1260–1263
searching, 960–961
static class member functions, 651–652
STL interface, 1038–1039
string access methods, 1259
structures, 144–145
template definition, 1249
types, 1250–1251
string class objects, 353–354
StringBad class, 628
constructors, 632–633
destructor, 633
strngbad.cpp, 630–631
strngbad.h, 628–629
vegnews.cpp sample program, 633–637
swapping, 1269
strings.cpp, 123
strlen() function, 123–124, 136, 177, 306, 632
strngbad.cpp, 630–631
strngbad.h, 629
Stroustrup, Bjarne, 14–15
strout.cpp, 1143
strquote.cpp, 402–403
strtref.cpp, 395
strtype1.cpp, 132
strtype2.cpp, 134
strtype4.cpp, 137
struct keyword, 140
structur.cpp, 142
structure initialization, C++11, 144
structure members, 141
structured programming, 12
structures, 140–142, 343, 346
addresses, passing, 351–353
arrays, 147–148
assignment, 145–146
bit fields, 148
compared to classes, 514
dynamic structures, new operator, 178–180
example, 142–144
nested structures, 682
passing/returning structures, 344–345, 348–351
polar coordinates, 347
rectangular coordinates, 346
reference variables, 394, 397–399
const keyword, 401
return references, 399–400
string class members, 144–145
Student class
contained object interfaces, 792–795
contained objects, initializing, 791
design, 787–788
methods, 793–795
private inheritance, 798, 804–805
base-class components, initializing, 798–799
base-class friends, accessing, 801–804
base-class methods, accessing, 800–801
base-class objects, accessing, 801
sample program, 795–797
studentc.h, 789–790
studentc.cpp, 793
studentc.h, 789–790
studenti.cpp, 802–803
studenti.h, 799
subdivide() function, 360–361
sube() function, 311
subobjects, 797
subroutines.
subscripts, 117
substrings, finding, 1260
find_first_not_of() method, 1262–1263
find_first_of() method, 1262
find_last_not_of() method, 1263
find_last_of() method, 1262
find() method, 1260–1261
rfind() method, 1261
subtraction operator (-), overloading, 574–578
sum_arr() function, 320–322, 325
sum() function, 344–345, 565–567
sum() method, 787, 807, 1046
sumafile.cpp, 294–295
Swap() function, 420–421, 1294, 1297
swap() method, 981, 1269, 1276
swap_ranges() function, 1294, 1297
swapp() function, 389
swapping strings, 1269
swapr() function, 389