Parameters, 197–201, 207–208, 224–226, 259–266, 348–351, 393–399, 416, 428–429, 462, 521–522, 640–644
arguments and, 197–198, 200–201, 265–268, 350–351, 462
array, 393–398
arrays and, 393–399, 416, 428–429, 462
C string, 462
call-by-reference, 259–266, 521–522
call-by-value, 197–198, 224–226
character I/O, 348–351
const
modifier, 396–399, 640–644
constant, 640–641
constant array, 397
formal, 197–201, 207–208, 224–226, 416
friend
functions and, 640–644
function arguments and, 416
function calls using, 197–198, 259–260
function declarations using, 199–201
function subtasks using, 259–266
local variables and, 224–226, 270–271
memory locations, 262–264, 395–396
mixed lists, 268–271
multidimensional arrays, 428–429
names, 207–208, 262
pointers, 521–522
procedural abstraction and, 207–208
programmer-defined functions, 197–201
size of arrays and, 396, 416
stream versatility, 348–349
Parent class, 602–603, 836, 846
Parentheses ( )
, 71, 78–79, 84–86, 130
Partially filled arrays, 413–415
Personal computer (PC), 2
Pointer variables, 523–525, 529
Pointers, 509–541, 676–677, 741–789, 1049–1051
addresses, 511–513
ampersand (&
) symbol and, 513
arithmetic performed on, 530–531
arrow (->
) operator used with, 744, 746
assignment operator (=
) and, 513–514, 516, 759–760
asterisk (*
) used for, 511–514
automatic variables, 520
call-by-reference parameters for, 521–522
call-by-value parameters, 676–677
dangling, 524–525
declaration of, 511–512
delete
operator, 519–520, 526–529, 532–533
dereferencing (*
) operator for, 512–513
destructors and, 676–677
dynamic arrays and, 523–529, 532–534, 676–677
dynamic variables and, 515, 518–520, 742, 759–760
freestore, 518–519
iterators, used as, 757
linked lists and, 741–789
memory management for, 518–520
names, 520–522
new
operator, 515–517
nodes, 742–744, 749–752, 757–759
NULL constant assigned to, 744–746
queues and, 773–778
smart, 1019–1025
stacks and, 767–768
static variables, 520
structures containing, 743–744
this
, 1049–1051
trees and, 763–764
typedef
function, 520–522, 532
variables and, 510–522, 523–525, 529, 743–744
Polymorphism, 17, 864–878
destructors made virtual for, 877–878
errors, 876–877
late (dynamic) binding, 865–871
overriding functions, 871
virtual functions and, 866–878
pop
function, 772
Postconditions, 275–281
pow
function, 187–188
Precedence rules, 114–115
Preconditions, 275–281
Predefined functions, 183–192, 358, 360–362, 459–462, 469–470
abs
, 186–187
absolute values, 186–187
arguments, 183–184, 461–462
C string, 459–462, 469–470
calls (invocations), 183–188
character I/O data, 358, 360–362
fabs
, 187
header files (< >)
and, 184–186
#include
directives, 184–186
isspace
, 360–361
parentheses ( )
and, 184, 191
pow
, 187–188
random number generation using, 188–189
sqrt
, 183–185, 187
srand
, 187, 189
strcmp
, 459–462
string-to-number conversions, 469–470
strncpy
, 459–462
toupper
and tolower
, 360–362
type casting using, 190–193
using directive, 186
value returned, 183, 360–362
priority_queue
class, 981–985
private members, 561–570, 595, 599, 626, 850–852
abstract data types (ADT) and, 595
accessor functions and, 569–570
classes using, 561–570
friend function access to, 626
inheritance and, 850–852
mutator functions and, 569–570
public members and, 561–570
Problem-solving phase, 15, 211–212, 277–278, 400–401
Procedural abstraction, 204–217, 273–281
algorithm design for, 212–213, 278
black box analogy, 204–207
case study: Buying Pizza, 211–217
case study: Supermarket Pricing, 276–281
coding, 213–214, 278–280
functions calling functions, 273–275
functions returning values, 204–217
information hiding, 205–206
nested loops and, 208–211
parameter names and, 207–208
postconditions, 275–281
preconditions, 275–281
problem analysis, 211–212, 277–278
program testing, 214–217, 281
pseudocode for, 213, 217
subfunctions using, 273–281
Processor (CPU), computer component, 3
Programmer role, 19
Programmer-defined functions, 193–203
arguments and, 197–198, 200–201
body, 196
bool
values, returning, 199
branching statements and, 203
call-by-value parameters, 197–198
calls, 196–198, 203
declaration, 193, 195–196, 199–201
definitions, 193–194, 196–197, 201–203
headers, 196, 200
parameters, 197–201
return
statements, 196–197, 202
spacing and line breaks in, 202
syntax of, 201–202
value returned, 196, 199
Programming, 12–17, 590–599. See also C++ programming; C++11 programming
abstract data types (ADT), 590–599
algorithms, 12–16
implementation phase, 15
object-oriented (OOP), 16–17
problem-solving phase, 15
program design for, 15–17
software life cycle, 17
Programs, 2, 7–11, 13–16, 27–31
algorithms for, 13–16
compiler, 9–11, 27–30
computer software as, 2, 7–8
debugging, 29–31
design of, for programming, 15–17
executing, 8
high-level languages for, 8–9
implementation design phase, 15
language translation and, 8–11
linker, 9–11
logic errors, 30–31
object code
problem-solving design phase, 15
run-time errors, 30
running, 8–11
source code, 9
syntax error, 30
testing, 27–31
protected
members, 852–854
Pseudocode, 213, 217
public members, 561–570
accessor functions and, 569–570
classes using, 561–570
mutator functions and, 569–570
put
function, 343–344
putback
function, 344–345