< Previous | Contents | Next >
R
rand()function, 69–70 random numbers, generating,
calculating number within range, 71–72
random_shuffle() algorithm, 134–135, 143
rank m_Rank member, BlackJack
Card class, 359
reallocation, vector memory, 136 reassigning pointers, 229
redundant parentheses, 68 reference operator (&),
references, 187–217
versus constant pointers, 232 creating, 189–190
deciding how to pass arguments, 198
defined, 217 passing
to alter arguments, 191–194 constant references,
Inventory Displayer pro- gram, 195–196
returning, 198–203
altering object through, 202 assigning to reference, 202 assigning to variable, 202 displaying value of, 201 Inventory Referencer
Tic-Tac-Toe game, 203–217 announceWinner() function, 217
askNumber()function, 209
computerMove()function, 213–216
creating list of functions, 205
displayBoard()function, 210–211
humanMove()function, 213
instructions()function, 208
opponent()function, 210
setting up, 205–207
winner()function, 211–212 values
refToElement() function header, 200–201, 240
relational operators, 40tbl, 44
reserve()member function, 137
restricting pointers, 243, 251
return statement, 50, 158,
return type, constructor, 262 return values, function, 157–158
return statement, 158 specifying return type, 157 using, 158
altering object through, 243–244
assigning to pointer, 242 assigning to variable value
pointed to by returned pointer, 242–243
Inventory Pointer program, 239–240
using to display value, 241–242
returning references, 198–203, 220 altering object through, 202 assigning, 202
assigning to reference, 202 assigning to variable, 202 displaying value of, 201 Inventory Referencer program,
reusability, class, 332–333 role-playing game (RPG), 72 run-time errors, 4