Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

lafore_robert_objectoriented_programming_in_c

.pdf
Скачиваний:
47
Добавлен:
27.03.2023
Размер:
8.94 Mб
Скачать

 

 

reverse iterators

1005

 

 

 

writing, 824

R

not equal to (!=) operator,

 

aggregate declarations,

77

 

rand() library function,

 

830-831

uses, 76-78

 

attribute declarations,

289

relationships

 

830

random access iterators,

classes, 489-490

 

class declarations, 830

733-734, 755

“has a” relationships,

 

CPP files, 831

random numbers, gener-

415-419

 

header files, 825

ating, 289-290

“kind of” relationships,

 

prohibiting copying, 539

random_shuffle algo-

415

 

projects

rithm, 900

remainder (%) operator,

 

C++Builder, 873-878

Rational Software, 23

61

 

multifile programs,

Rational Unified Process,

remove algorithm, 899

 

637-638

804-805

remove_copy algorithm,

 

Visual C++, 866

raw storage iterators, 763

899

 

protected access specifier,

rbegin() member func-

remove_copy_if

 

377, 379

tion, 731

algorithm, 899

 

protected keyword, 861

rdbuf() member function,

remove_if algorithm, 899

 

prototypes, 164

589

rend() member function,

 

public access specifier,

read() member function,

731

 

377-379, 399

575, 593

replace algorithm, 898

 

public inheritance,

reading

replace_copy algorithm,

 

396-399

C-strings

898

 

public keyword, 218-219,

embedded blanks,

replace_copy_if

 

396, 861

293-294

algorithm, 898

 

pure virtual functions,

multiple lines, 294-295

replace_if algorithm, 898

 

510-511

data in formatted files,

replace() member func-

 

push() member function,

585-586

tion, 307

 

281-282, 383-384

objects from a disk, 593

resetiosflags()

 

push_back() member

recursion, 193-195

manipulator, 273, 572

 

function, 744

references

return keyword, 861

 

push_front() member

arguments (functions),

return statement, 177-181

 

function, 748

182-188

return values of over-

 

push_heap algorithm, 904

books, 978-980

loaded operators,

 

pushing items in stacks,

register keyword, 861

323-325

 

281-282

reinterpret cast keyword,

returning

 

put pointer, 597-598

440, 861

structure variables from

 

put to operator, 34, 47, 54

reinterpret cast operator,

functions, 180-182

 

put() member function,

591

values by reference,

 

575, 588

relational operators

206-207

 

putback() member func-

equal to (==) operator, 77

values from functions,

 

tion, 575

greater than operator, 77

176-180

 

putch() function, 489

greater than or equal to

reusability, 21, 373

 

queues, 732

operator, 77

reverse algorithm, 900

 

 

less than operator, 77

reverse_copy algorithm,

 

 

less than or equal to opera-

900

 

 

tor, 77

reverse iterators, 763-764

 

 

 

 

 

reverse() member function

1006

reverse() member function, 749

rfind() member function, 306

right flag, 571 Ritchie, Dennis, 980 rotate algorithm, 900

rotate_copy algorithm, 900

RTTI (Run-Time Type Information) in Visual C++, 866

Rumbaugh, James, 23, 804, 978

Ruminations on C++, 979 Run-Time Type

Information (RTTI) in Visual C++, 866

S

Saini, Atul, 979 scientific flag, 571 scope of variables,

199-205

scope resolution operator, 236, 360, 384

Scott, Kendall, 979 search algorithm, 733,

737-738, 897

seekg() member function, 575, 598-600

seekp() member function, 576, 598

self-assignment, 552-553 self-containing classes,

473

sequence containers, 727-729, 743-751

arrays, 728 deques, 728-729 lists, 728-729 vectors, 728

sequence diagrams, 820-824

set_color() function, 883-884

set_cursor_pos() function, 883

set_difference algorithm, 903-904

set_fill_style() function, 883-884

set_intersection algorithm, 903

set_symmetric_difference algorithm, 904

set_union algorithm, 903 setdata() member func-

tion, 219-220

setf() member function, 571, 573-574

setfill() manipulator, 572 setiosflags manipulator,

273, 572

setjmp() function, 704 setprecision manipulator,

273, 572

sets, 729-730, 771-775 setw manipulator, 52-54,

292, 572

short integer variable, 42 short keyword, 861 showbase flag, 571 showdata() member func-

tion, 219-220 showpoint flag, 571 showpos flag, 571 Si Alhir, Sinan, 979 signed keyword, 861

single-stepping loops, 84 size of arrays, 265

size() member function, 310, 731, 744

sizeof keyword, 861 skipws flag, 571, 580 Smalltalk, 15, 219 smart pointers, 752-753

software development processes

beginning the process, 802 modern processes, 803 object-oriented program-

ming, 803

Unified Process, 804-805 waterfall process, 802-803

solutions to exercises, 916-975

solve() member function, 480

sort algorithm, 733, 737, 900

sort_heap algorithm, 904-905

sorting

array elements, 448-451 pointers, 476-477

source files, 30 spaghetti code, 123 specifiers, 218

sqrt() function, 65-66 srand() library function,

289 stable_partition algo-

rithm, 900

stable_sort algorithm, 900 stack is empty error mes-

sage, 384

stacks, 279-282, 732 Standard Template

Library (STL) algorithms, 726-727,

732-733, 735, 896-907 containers, 755,

758-759

count() algorithm, 736 find algorithm, 735-736 for each(), 742 function objects, 739

if algorithm, 740-741 iterators, 757-758,

761-763, 909-911 merge() algorithm, 738

 

 

strcpy() library function

1007

 

 

 

search() algorithm,

statements

associative containers,

 

737-738

assignment statements,

729-730, 771-778

 

sort() algorithm, 737

40-41, 139

iterators, 756

 

transform(), 742-743

control statements

member functions,

 

user-written functions,

decisions, 93-111,

730-731

 

739-740

119-123

sequence containers,

 

containers, 726-727

loops, 78-93

728-729, 743-751

 

adapters, 731-732

uses, 76

developers, 726

 

algorithms, 755,

program structure, 32-33

function objects, 786

 

758-759

return statement, 177-181

modifying container

 

associative containers,

syntax, 32-33

behavior, 794

 

729-730, 771-778

static binding, 509

predefined function

 

iterators, 756

static cast keyword, 861

objects, 786-789

 

member functions,

static class data, 249-252

writing, 789-794

 

730-731

static functions, 529-532

iterators, 726-727,

 

sequence containers,

static keyword, 861

733-734, 751, 759

 

728-729, 743-751

static local variables,

adapters, 763-766

 

developers, 726

204-205

algorithms, 757-758,

 

function objects, 786

stdio flag, 571

761-763

 

modifying container

Stepanov, Alexander, 726,

containers, 756

 

behavior, 794

896, 979

data access, 759-760

 

predefined function

Stevens, Perdita, 979

data insertion, 760-761

 

objects, 786-789

STL (Standard Template

interfaces, 753-755

 

writing, 789-794

Library)

smart pointers, 752-753

 

iterators, 726-727,

algorithms, 726-727,

stream iterators,

 

733-734, 751, 759

732-733, 735, 896-907

767-770

 

adapters, 763-766

containers, 755,

member functions,

 

algorithms, 757-758,

758-759

907-909

 

761-763

count(), 736

problems with, 734-735

 

containers, 756

find, 735-736

storing user-defined

 

data access, 759-760

for each(), 742

objects, 778-786

 

data insertion, 760-761

function objects, 739

STL Tutorial and

 

interfaces, 753-755

if, 740-741

Reference Guide, 979

 

smart pointers, 752-753

iterators, 757-758,

storage classes (vari-

 

stream iterators,

761-763, 909-911

ables), 199-200, 203,

 

767-770

merge(), 738

205, 209

 

member functions,

search(), 737-738

storing user-defined

 

907-909

sort(), 737

objects, 778-786

 

problems with, 734-735

transform(), 742-743

strcat() library function,

 

storing user-defined

user-written functions,

302

 

objects, 778-786

739-740

strcmp() library function,

 

The Standard Template

containers, 726-727

337, 479

 

Library, 979

adapters, 731-732

strcpy() library function,

 

state diagrams, 490-492,

algorithms, 755,

296, 456

 

675

758-759

 

 

 

 

 

 

1008

stream classes

 

 

 

 

 

stream classes

errors, 577

insert(), 307

 

 

advantages, 568

checking, 580-583

length(), 310

 

copying, 576

error-status flags,

max size(), 310

 

fstream class, 583, 596

577-578, 587-588

replace(), 307

 

hierarchy, 568-570

inputting numbers,

rfind(), 306

 

ifstream class, 568, 583

578-579

size(), 310

 

ios class, 569-570

inputting strings and

substr(), 308

 

formatting flags,

characters, 580

swap(), 304

 

570-571

no-input input, 579-580

new operator, 462-463

 

functions, 573-574

too many characters,

strings, 264

 

manipulators, 571-572

579

arrays of pointers, 456-458

 

iostream class, 570

input/output, 568

C-strings, 290

 

iostream_withassign class,

manipulators, 41-42

arrays, 297-298

 

570, 576

memory, 620-622

blanks, 293-294

 

istream class, 569-570,

overloaded extraction and

buffers, 292

 

574-575

insertion operators,

class members,

 

istream_withassign class,

616-620

298-299

 

570, 576

printer output, 624-626

concatenating, 332

 

istrstream class, 620

string class, 302, 310

constants, 292-293

 

ofstream class, 583

accessing characters in

converting to string

 

ostream class, 569-570,

string objects, 309-310

objects, 348-350

 

575-576

assigning objects, 303-304

copying, 295-296

 

ostream_withassign class,

comparing objects,

multiple lines, 294-295

 

576

307-308

pointers, 452-456

 

ostrstream class, 620-622

concatenation, 332-334

user-defined strings,

 

predefined stream objects,

converting to C-strings,

300-302

 

576-577

348-350

variables, 290-291

 

strstream class, 620

defining objects, 302-304

comparing, 336-337, 479

 

stream iterators, 767-770

editing objects, 306-307

disk file I/O, 586-588

 

streams

finding objects, 305-306

overview, 34-35

 

advantages, 568

input/output, 304-305

string class, 302, 310

 

cin, 45-46

member functions

accessing characters in

 

closing, 591

append(), 307

string objects,

 

command-line arguments,

at(), 309

309-310

 

622-624

capacity(), 310

assigning objects,

 

cout, 34

compare(), 307-308

303-304

 

definition of, 568

copy(), 309

comparing objects,

 

disk file I/O, 583

erase(), 307

307-308

 

binary I/O, 589-591

find_ first_not_of(), 306

concatenation, 332-334

 

char strings with

find_first_of(), 306

converting to C-strings,

 

embedded blanks,

find_ last_not_ of(),

348-350

 

586-588

306

defining objects,

 

character I/O, 588-589

find_last_of(), 306

302-304

 

formatted file I/O,

find(), 306

editing objects,

 

583-586

getline(), 304-305

306-307

 

object I/O, 591-596

 

 

 

 

 

 

 

 

typename keyword

1009

finding objects,

returning structure vari-

templates

 

305-306

ables from functions,

class templates, 690-693

 

input/output, 304-305

180-182

determining storage

 

new operator, 462-463

syntax, 132-133

parameters, 701-702

 

strlen() library function,

tags, 133

example, 696-698

 

296

styles of loops, 83

syntax, 694-696

 

Stroustrup, Bjarne,

subscript [ ] operator,

UML, 702

 

978-979

340-343

user-defined data types,

 

strstream class, 620

substr() member function,

698-701

 

struct keyword, 133, 861

308

function templates,

 

structured programming,

subtraction (-) operator,

682-685

 

11-13

60

arguments, 686-689

 

structures

swap algorithm, 733, 898

blueprints, 686

 

arrays, 277-279

swap_ranges algorithm,

compilers, 685-686

 

accessing elements, 278

898

determining what

 

defining, 278

swap() member function

works, 689-690

 

similarities to, 264

string class, 304

syntax, 685, 688

 

assignment statements, 139

vectors, 745

tips for simplifying, 686

 

classes, 148

switch keyword, 107, 861

uses, 682

 

declaration, 133-135

switch statement,

ternary operators, 117

 

defining, 133-135

107-111

text in strings, 264

 

definition, 132

syntax

Thinking in C++, 978

 

examples

class templates, 694-696

this keyword, 861

 

card game, 145-148

classes, 216-217

this pointer, 547-552

 

measurements, 139, 141

comments, 36-38

throw keyword, 705, 862

 

members, 132

constructors, 230-231

throwing exceptions, 705,

 

accessing, 136-137,

exceptions, 704-706

708

 

142-143

function templates, 685,

transform algorithm,

 

initializing, 138-139

688

742-743, 898

 

names, 133

pointers, 434-435

trees, 729

 

nesting

statements, 32-33

true keyword, 862

 

accessing members,

structures, 132-134

try blocks, 705, 709

 

142-143

 

try keyword, 705, 709,

 

depth of, 145

 

862

 

initialization, 144-145

T

type casts, 58-60

 

overview, 141-142

type information

 

user-defined type con-

tags (structures), 133

(classes), 553-557

 

versions, 144

Teale, Steve, 979

type safety, 60

 

overview, 247

tellg() member function,

typedef keyword,

 

passing to functions,

598, 601

650-651, 862

 

171-176

tellp() member function,

typeid keyword, 862

 

passing to functions by ref-

598

typeid operator, 553,

 

erence, 186-188

template keyword, 685,

556-557

 

 

688, 692, 861

typeid() member function,

 

 

 

608-616

 

typename keyword, 862

1010

UML

 

 

 

 

 

U

multiplicity, 489

upper_bound() member

 

 

UML (Unified Modeling

navigability arrows,

function, 774-775

 

358

uppercase flag, 571

 

Language)

uses, 357

use case modeling

 

activity diagrams, 808,

collaboration diagrams,

actors, 805-806, 812

 

815-816

820

class diagrams, 820-824

 

additional references,

dependencies, 703

Landlord program exam-

 

978-979

history, 23-24

ple, 809, 811-843

 

class diagrams, 820-821

interaction diagrams, 808

scenarios, 806, 815

 

associations, 357-358

multiplicity symbols,

use cases, 806, 812-813

 

inheritance, 376

489-490

use cases to classes, 808,

 

multiplicity, 489

object diagrams, 539-540

816-818

 

navigability arrows,

parameterized classes, 702

use case descriptions,

 

358

sequence diagrams,

807-808, 813-814

 

uses, 357

820-824

use case diagrams,

 

collaboration diagrams,

state diagrams, 490-492,

806-807

 

820

675

uses, 805

 

history, 23-24

stereotypes, 703

verbs to messages,

 

interaction diagrams, 808

templates, 702

818-819

 

multiplicity symbols,

use case diagrams,

user-defined data types

 

489-490

806-807

class templates, 698-701

 

object diagrams, 539-540

The Unified Modeling

converting basic type to

 

parameterized classes, 702

Language Reference

user-defined type, 347

 

sequence diagrams,

Manual, 979

converting to basic types,

 

820-824

The Unified Modeling

345-347

 

state diagrams, 490-492,

Language User Guide,

converting user-defined

 

675

979

type to basic type,

 

templates, 702

Unified Process, 804-805

347-348

 

use case diagrams,

union keyword, 862

user-defined objects,

 

806-807

unique algorithm, 899

778-786

 

UML Distilled, Second

unique_copy algorithm,

using directive, 36

 

Edition, 979

899

using keyword, 862

 

UML in a Nutshell, 979

unique() member func-

Using UML, 979

 

unary operators, 117,

tion, 749

 

 

320-328

unitbuf flag, 571

 

 

unidentifed identifier

unknown variable error

V

 

error message, 66

message, 200

 

Unified Modeling

unlock manipulator, 572

values

 

Language (UML)

unsetf() member func-

 

assigning to variables,

 

activity diagrams, 808,

tion, 571, 573

 

40-41

 

815-816

unsigned keyword, 862

 

passing to functions,

 

additional references,

unsigned long data type,

 

170-171

 

978-979

651

 

returning by reference,

 

class diagrams, 820-821

unsigned variables, 55-56

 

206-207

 

associations, 357-358

upper_bound algorithm,

 

returning from functions,

 

inheritance, 376

902

 

176-180

 

 

 

 

 

 

 

 

 

write() member function

1011

variables

passing to functions,

debugging programs

 

assigning values to, 40-41

169-170

breakpoints, 870

 

assignment statements,

pointers, 433-434,

overview, 868-869

 

40-41

436-439, 442-443

single-stepping, 869

 

bool variables, 51-52, 114

scope, 199-205

stepping into functions,

 

C-strings, 290-291

static local variables,

869

 

character variables, 42-43

204-205

watching variables, 869

 

data types

storage classes, 199-200,

errors, 865-866

 

casts, 58-60

203, 205, 209

file extensions, 864

 

converting, 56-60

structures

multifile programs,

 

overview, 54

accessing members,

866-867

 

type safety, 60

136-137, 142-143

projects, 866

 

unsigned data types,

assignment statements,

RTTI, 866

 

55-56

139

screen elements, 864

 

declarations, 40

classes, 148

single-file programs, 864

 

defining, 47, 54

declaration, 133-135

source files, 867

 

definitions, 40

defining, 133-135

versions, 864

 

floating point variables

definition, 132

workspaces, 866

 

double, 49-50

examples, 139, 141,

writing new files, 865

 

float, 48-49

145-148

void keyword, 164, 178,

 

long double, 49-50

initializing members,

862

 

overview, 48

138-139

void pointers, 439-440

 

for loops, 85

members, 132, 136

volatile keyword, 862

 

global variables, 202-203

names, 133

 

 

identifiers, 40

nesting, 141-145

 

 

initializing, 44, 201, 203,

syntax, 132-133

W-Z

 

205

tags, 133

 

instance variables, 15, 221

visibility, 82-83

w = width() member

 

integer variables

vectors, 728, 743-747

 

function, 573

 

bit numbers, 42

virtual base classes,

 

wait() function, 883-884

 

defining, 38-39

518-520

 

Watch windows, 84

 

int integer variable,

virtual destructors,

 

wchar t keyword, 862

 

38-39

517-518

 

wchar t variable, 43

 

long integer variable,

virtual functions, 504

 

while loop, 86-90

 

42

examples, 511-517

 

whitespace, 33

 

overview, 38

pointers, 507-509

 

width() member function,

 

short integer variable,

pure virtual functions,

 

573

 

42

510-511

 

Windows Game

 

true/false values,

virtual keyword, 507, 520,

 

Programming for

 

117-118

862

 

Dummies, 980

 

inter-file variables,

visibility of variables,

 

workspaces (Visual C++),

 

638-641

82-83

 

866

 

local variables, 199-201

Visual C++

 

write() member function,

 

names, 40

building existing files,

 

575, 592

 

output variations, 41

864-865

 

 

 

Console Graphics Lite,

868

writing

1012

writing

data to formatted files, 584-585

function objects, 789-794 objects to a disk, 592 programs, 824

aggregates declarations, 830-831

attribute declarations, 830

class declarations, 830 CPP files, 831

header files, 825 ws manipulator, 572 xalloc class, 718

XOR logical operator, 116