< Previous | Contents | Next >
S
scope resolution operator (::), 9, 125, 259, 345
hiding global variables, 169 nested, 165–166, 185
seeding random number generator, 70–71, 79, 134
self-documenting code, 21 semicolon (;)
sequential container, 138, 147 set STL container, 139 shallow copy, 310
short modifier, 18
signed modifier, 18 Simple Boss 2.0 program,
Simple Boss program, 333–335 Simple Critter program, 256–257 64-element array, 103
size()member function, 92, 120
skYesNo2() function, 158
sort() algorithm, 135
stack STL container, 139 standard I/O, 5
std namespace, 10–13 Game Over 2.0 program,
using declarations, 12–13
using directive, 11, 13
standard library, 5, 35 Standard Template Library.
See STL
Static Critter program, 270–271
static data members, 282 accessing, 272–273 constant member function
Static Critter program, 270–271
static keyword
declaring static data members, 272
declaring static member function, 273
std namespace, 10–13
using declarations, 12–13
using directive, 11, 13
stepwise refinement defined, 146 when to use, 148
STL (Standard Template Library), 115–149
algorithms, 131–135
find(), 134
sort(), 135
containers, 138–139
ending, 145 entering main loop,
getting player's guess, 144–145
initializing variables and constants, 143
iterators, 123–131 accessing member
functions of vector element, 129–130 changing value of vector element, 128–129
declaring, 125–126
erase()vector member function, 130–131
Hero's Inventory 3.0
insert()vector member function, 130
looping through vector, 126–128
pseudocode, 139–140 stepwise refinement,
vectors, 116–122, 136–138 calling member functions of
clear()member function, 122
STL (Standard Template Library) (continued )
declaring, 119–120 element insertion and
empty()member function, 122
Hero's Inventory 2.0
pop_back()member function, 122
push_back() member function, 120
size()member function, 120
string argument, 175
string m_Name member, BlackJack GenericPlayer class, 359
string objects, 33, 38, 89–96, 135
empty()member function, 96
erase()member function, 95
find() member function, 94–95
size()member function, 92 String Tester program, 89–91
strings
structure, defined, 284 subclass. See derived classes
subscripting operator ([ ]), 93, 99,
suit m_Suit member, BlackJack
Card class, 359
superclass, 335. See also base class Swap Pointer Version program,
switch statements, 39, 51–54, 77 creating ways to branch, 54 defining variables inside, 166 Menu Chooser program, 52–53