C - Program - 2e - Index.pdf
(
69 KB
)
Pobierz
Index
--
decrement operator, 65–66
-
subtraction operator, 59
!
NOT operator, 101–102
" "
text start and end, 73
%
modulus operator, 59,
152–154
&
address operator, 249–252,
253–254, 260
&&
AND operator, 101–102
*
indirection asterisk operator,
252, 412
*
multiplication operator, 59
.
dot operator, 80–82, 419
/
division operator, 59
//
comments, 32, 41
?
ternary operator, 117–118
||
OR operator, 101–102
+
addition operator, 59
++
increment operator, 65–66
=
assignment operator, 52
->
right arrow operator, 419
>> extraction operator, 50–52
#define
statement, 67–69, 70,
596
#endif
statement, 596
#ifndef
statement, 596
#include
statement, 32–33, 187,
594–595
<cmath>
command, 65
multiple inheritance and,
481–483
private members, 472
protected members, 472
public members, 472
Accumulation operators, 66–67
Addition (
+
) operator, 59
address (
&
) operator, 249–252,
253–254, 260
data variables and, 249–252
pointers and, 253–254
references and, 260
Algorithm design, 26–27
American National Standards
Institute (ANSI), 6
AND (
&&
) operator, 101–102,
144, 146–148
Arguments, functions as, 184
Arithmetic operators, 53, 59–65,
412
<cmath>
command, 65
addition (
+
), 59
division (
/
), 59
fractional calculations, 61–62,
62–65
intermediate results with, 59–61
modulus (
%
), 59
multiplication (
*
), 59
operand, 59
overloaded, 412
precedence of, 53
subtraction (
-
), 59
temperature conversions, 62–65
Array of chars, 42
Arrays, 292–367, 407–412
call-by-reference, 306–308
character, 295, 312–322
Colorado river stream gauge
flow data program exam-
ple, 352–356
compiler errors, 341–342
C-strings, 295, 312–322
data files and, 333–340
data variables used in, 293–294
declaration, 298–300
defined, 293
element, 294
errors encountered with,
341–342
filing from data files, 333–340
FindFavorite
function
program examples,
342–346
fo
r loops and, 296–298
functions and, 305–312,
327–333
fundamentals of, 294–304
index, 294
initialization, 298–300
link errors, 342
multidimensional, 322–327,
327–333
null-terminated character
strings, 295
objects in classes, 407–412
out of bounds, 300–303
passing to functions, 306–308
phone list objects program
example, 408–412
pointers, 305–306
random numbers, generating
and sorting using, 308–312
A
Abstraction, object-oriented
principle of, 425
Access specifiers, 375–377
Access specifiers, 472, 481–483
base class, 481–482
625
626
❚
Index
seven dwarfs and files program
example, 346–351
single-dimensional, 294
variables, 294–295
vectors, comparison with,
303–304
zero indexed, 296
ASCII character codes, 555–561
Ask()
function, 401–402
Assignment operator (=), 52
Associativity, defined, 53
at()
function, 142–144
atof
function, 317
atoi
function, 317
atol
function, 317
Automatic variables, 205
defined, 43
format conventions, 563
troubleshooting, 20–21
wxWidgets, 8
C-strings, 295, 312–322, 342–346,
346–351
atof
function, 317
atoi
function, 317
atol
function, 317
char
function, 319
defined, 295
FindFavorite
function
program examples,
342–346
functions in
cstring
library,
320
initialization, 313
input, 315–319
null character, 312, 313–315
null-terminated character
strings, 295
seven dwarfs and files program
example, 346–351
Call statements, 186, 194–195
Call-by value functions, 195–198
Call-by-reference function,
255–259, 260–262, 306–308
passing arrays to functions
using, 306–308
pointers, using, 255–259
references, using, 260–262,
306–308
Calling functions, 186, 194–195,
195–198, 255–259, 380–382
address (
&
) operator, 260
call statements, 186, 194–195
call-by-reference, 255–259,
260–262
call-by-value, 195–198
cout
statement, 382
indirection asterisk (
*
)
operator, 254–259
writing classes, for, 380–382
char
data type, 42
char
function, 319
Character arrays,
see
C-strings
Child class, 465
cin
object, 50–52, 78–79, 140–141
debugging and, 140–141
extraction operator (>>), 50–52
C
C language, 6–10
compiled language, as a, 8–10
history of, 6–7
C++ software, 2–23, 24–99,
527–504, 541–554, 555–561
algorithm design, 26–27
American National Standards
Institute (ANSI), 6
ASCII character codes for,
555–561
compiled language, as a, 8–10
construction techniques,
19–20
cross-platform code libraries
and, 8
developer skill set, 3–4
development environment
tools, 527
Graphical User Interface GUI
framework, 8
Help system, 535–538
history of, 7
installation of, 528
International Standards
Organization (ISO), 6
introduction to, 3
keyword dictionary, 541–553
object-oriented programming
and, 11–13, 13–19
open source libraries, 10
operators in, 554
program project construction
steps, 528–535
programmers, rules for, 5–6
programming fundamentals,
25–29
source code, 5
steps to programming success,
28–29
structured programming, 11,
13–19
terminology for, 29–30
textbook concerns of, 4–5
top-down programming, 11
B
Base class, 469–470, 481–482,
483–484, 490, 491–500
access specifiers, 481–482
constructor functions,
483–484, 490
defined, 470
destructor functions, 484
inheritance and, 469–470
multiple inheritance and,
481–482
specifiers in derived class
declarations, 482
virtual functions in, 491–500
Binary file input/output, 577–581
Binary operators, 101–102,
412–418
classes, in, 412–418
conditional statements, as,
101–102
overloaded, 412–418
Bits, defined, 43
Block scope, 205
Boolean values, functions and,
217–221
Braces, 109, 123
if
statements, using with, 109
loops, using with, 123
break;
statements, 122, 134–135
Bytes, 43, 562–563
computer memory and, 562–563
627
❚
Index
reading data using, 50–52, 78–79
string class and, 79, 140–141
Class constructor functions,
377–378
Class definition, 374
Class destructor function, 404–407
Class member, 374, 399–404,
426, 427
Ask()
function, 401–402
defined, 374
have you had your birthday
program example,
399–404
object-oriented principle of, 426
objects as a, 399–404
overloaded, programming
error due to, 427
Write()
function, 401–402
Classes, 12, 78–82, 142–144,
211–213, 265–268,
334–340, 465, 469–470, 472,
481–482, 490, 491–500.
See also
Inheritance; Writing
classes
access specifiers, 472, 481–483
base, 469–470, 481–482,
483–484, 490, 491–500
binary operators in, 412–418
child, 465
constructors, 377–378, 483–490
defined, 12
derived, 469–470, 481–482,
483–484, 490
destructor function, 404–407,
483–490
errors while writing, 424–427
get
function, 391–395, 440–444
ifstream
, 334–340
object-oriented principles, 424,
425
objects and, 78–82, 368–463
ofstream
, 334–340
overloaded operators, 412–418
parent, 465
pointers and, 419–424
queue
relationship of in inheritance,
469
set
function, 391–395, 440–444
stock tank calculator program
example, 440–446
string
<string>
, 78–80, 370
stringstream
<sstream>
,
211–213
switch
statement, 444–446
teacher’s helper, grader
program example, 433–440
unary operators in, 412–418
vector
<vector>
, 142–144, 370
virtual functions in, 491–500
writing, 371–399
Comments
(//
), 32, 41
Commercial off-the-shelf
(COTS) software, 500
Compiler, defined, 8
Compiler errors, 37–39, 214,
215–216, 271–272, 341–342
arrays, 341–342
cannot convert parameter,
271, 341–342
function headers missing,
215–216
functions and, 214, 215–216,
271–272
illegal indirection, 271–272
language syntax and, 37–39
parameters unaccepted, 214
writing functions, 214, 215–216
Compile-time polymorphism,
491
Computer memory, 247–249,
562–567
byte formats, 562–563
disks and, 562–567
functions and, 247–249
hex address, 247–248
hexadecimal notation, 247,
563–566
media, 563
Concurrency, object-oriented
principle of, 425
Conditional statements,
101–103, 101–103,
136–137, 144, 146–148
AND (
&&
) operator, 101–102,
144, 146–148
logical operators, 101–103, 104
NOT (
!
) operator, 101–102,
144, 146–148
OR (
||
) operator, 101–102,
144, 146–148
relational operators, 101–103,
104, 136–137
const
access modifier, 69–70
Constants, interpretation of for
precedence of operations,
55–56
Constructors, 377–378, 483–490,
582, 586
base class, 483–484, 490
class functions, 377–378
derived class, 483, 490
doctor is a person program
example, 484–490
inheritance and, 483–490
overloaded, 377, 484
passing parameters into
overloaded, 484
string class, 582
vector class, 586
Containers, C++ programming,
42–43
continue
statements, 134, 135
Control statements, 100–177
AND (
&&
) operator, 101–102,
144, 146–148
braces, use of with, 109, 123,
138–139
break;
, 122, 134–135
conditional statements,
101–103, 144, 146–148
continue
, 134, 135
counter values, 136
debugging, 140–141
else-if
, 110–112
goto
, 134
if
, 103–117, 139–140
if-else
, 107–117
infinite series calculation pro-
gram example, 148–150
jump statements, 134–135
logical operators, 101–103, 104
6queue7,
265–268,
370–371
references and, 419–424
628
❚
Index
loops and, 122–134
NOT (
!
) operator, 101–102,
144, 146–148
OR (
||
) operator, 101–102,
144, 146–148
infinite series (PI) calculation
program example, 148–150
pond pump calculator program
example, 162–165
precedence of operators in, 103
program flags, 154–158
random number generator
program example,
150–152, 152–154
relational operators, 101–103,
104, 136–137
return
, 134
search for the name program
example, 154–158
semi-colon placement,
138–139
switch
, 118–122
ternary (
?
) operator, 117–118
time conversion program
example, 158–160
troubleshooting, 136–141
variable evaluations, 137–138
vector class, 142–144
vowel counting program
example, 160–162
Counter values, 136
cout
object, 34–35, 73–74, 74–76,
78, 382
calling class functions using,
382
escape sequences and, 73–74
ios
formatting flags and,
74–76, 84–85
screen output and, 34–35
writing data using, 78
Cross-platform code libraries, 8
Colorado river stream gauge
flow data program
example, 352–356
format of, 568–570
header line, 568, 569
ifstream
class, 334–340
input/output, 568–581
iostream
library, 570–577
maximum and minimum arrays,
finding with, 337–340
ofstream
class, 334–340
phone bill program example,
334–337, 368–340
reading to end of, 569–570
sentinel value, 568–569
trailer value, 568–569
Data types, 41–46, 53–55
array of chars, 42
bits, 43
byte, 43
char
,42
containers, 42–43
defined, 42
double
,42
floa
t, 42
int
, 42, 45
integer size, 45–50
labels, 42–43
modifiers, 43–45
precedence of operations,
53–55
stored values of, 53–55
string, 42
values, 42–43
variables, 42–43
Data variables, 245–249,
249–250, 269, 293–294
address (
&
) operator, 249–252
arrays, using single in, 293–294
memory and, 245–249
properties of, 250–251, 269
sizeof
operator, 246–247
Debugging, 140–141, 600–613
C++ features, 605–613
cin
object, 140–141
classes, 604–605
concepts of, 600
functions, 603–604
getline()
function, 140–141
string class, using, 140–141
terminology for, 601
Declaration, 46–48, 186–187,
191–193, 198–200,
298–300, 323, 374
arrays, 298–300, 323
class, 374
function header line, 47–48, 186
functions, 186–187, 191–193
multidimensional arrays, 323
prototype statements, 191–193
undeclared identifiers, 198–200
variables, 46–48
Decrement operators (--), 65–66
Default input parameter list
functions, 202–204
Definition, functions, 186–187,
192–200
Derived class, 469–470, 481–482,
483–484, 490
base class specifiers in
declarations, 482
constructor functions,
483–484, 490
defined, 470
destructor functions, 484
inheritance and, 469–470
multiple inheritance and,
481–482
overloaded constructor
functions, 484
Destructors, 404–407, 483–490
class functions, 404–407
inheritance and, 483–490
overloaded, 377, 484
Division (
/
) operator, 59
do while
loops, 132–134
Dot operator (
.
), 80–82
double data type
,42
Dynamic memory allocation,
264–265
D
Data casts, 70–73
Data files, 333–340, 352–356,
568–581
arrays and, 333–340
binary input/output, 577–581
E
else-if
statements, 110–112
empty()
function, 266
Encapsulation, object-oriented
principle of, 424, 425
629
❚
Index
Errors, 37–39, 214–216, 271–272,
341–342, 424–427.
See also
Compiler errors; Link
errors
compiler, 37–39, 214, 215–216,
271–272, 341–342
language syntax and, 37–39
link, 214–215, 342
overloaded member functions,
427
undeclared identifier, 424–426
unresolved external, 214–215,
342, 426–427
writing classes, 424–427
writing functions, 214, 215–216
Escape sequences, 34, 73–74
C++ use of, 73
new line output (
/n
), 34, 73–74
types of, 77
extern
keyword, 598–599
call-by value, 195–198
call-by-reference, 255–259,
260–262, 306–308
call statements, 186, 194–195
called, 186
calling, 186, 194–195, 195–198,
255–259
compiler error, 214, 215–216,
271–272
data variables, 245–249, 249–250
declarations, 186–187,
191–193
default input parameter list,
202–204
defined, 11, 31, 179
definition, 186–187, 192–194
errors encountered with,
213–216, 270–272
function_name
, 183–184
header line, 33–34, 192–194,
215–216
I scream for ice cream program
example, 275–277
infinite series (PI) program
example, 148–221–223
input parameters, 184, 214
Is it prime? program example,
216–221, 272
main
, 31, 33, 180, 187
memory, 245–249
multiple files program
examples, 227–231,
231–235
overloaded, 200–202, 223–227
pointers, 252–254, 254–260,
264–265, 269, 270–272,
275–277, 305–306
program flags, 216–217
prototype, 186–187, 191–192
queue class
<queue>
, 265–268,
280–282
random numbers, generating
and sorting using, 308–312
references, 260–264, 269,
270–271, 277–280, 306–308
requirements for writing,
186–200
return
statement, 193–194
returning items from, 244–291
search for woman’s name
program example,
277–280
sizeof
operator, 246–247
song organizer program
example, 280–282
stringstream class
<sstream>
,
211–213
variables in, 204–211, 250–251,
269
writing, 179–243
G
get
function, 391–395, 440–444
getline()
function, 79,
140–141
debugging and, 140–141
reading strings using, 79
Global variables, 205–209
goto
statements, 134
Graphical User Interface (GUI)
framework, 8
F
Filing arrays from data files,
333–340
find
function, 81
float
(floating point variable)
statements, 137–138
floa
t data type, 42
for
loops, 124–128, 296–298, 324
arrays and, 296–298, 324
control statements, 124–128
nested, 324
two-dimensional arrays, 324
Functions, 11, 31, 33–34, 178–243,
244–291, 305–312, 327–333.
See also
Virtual functions
#include
statement, 187
address (
&
) operator, 249–252,
253–254, 260
arguments, 184
arrays and, 305–312, 327–333
basic format of, 183–186
bathtub volume calculator
program example, 282–285
body, 186, 192–194
Boolean values, 217–221
calculating pay program
example, 223–227
H
Header file, 378–379
Header line, 33–34, 192–194,
568–569
main
function, 33–34
data files and, 568–569
function, 33–34, 192–194
Hello World!, program example,
31–34
Help system, 535–538
Hex address, 247–248
Hexadecimal notation, 247,
563–566
How’s the Weather, program
example, 34–35
I
Identifier naming rules, 47
if-else
statements, 107–117
if
statements, 103–117, 139–140,
145
braces, using with, 109, 139–140
else-if
statements, 110–112,
145
Plik z chomika:
Januszek66
Inne pliki z tego folderu:
Back Seat_ A Mumbai Tale - Aditya Kripalani.mobi
(755 KB)
Brief Wondrous Life of Oscar Wao, The - Junot Diaz.opf
(3 KB)
Don't Make Me Think, Revisited_ - Steve Krug.mobi
(9256 KB)
M. T. Anderson - Norumbegan 03 - The Empire of Gut and Bone # (v5.0).epub
(2209 KB)
M. T. Anderson - Norumbegan 02 - The Suburb Beyond the Stars # (v5.0).epub
(2105 KB)
Inne foldery tego chomika:
Dokumenty
Galeria
LUDLUM ROBERT
Midi - Kar
Mszał Rzymski PL
Zgłoś jeśli
naruszono regulamin