Tải bản đầy đủ (.pdf) (7 trang)

c by dissection 2002 1851

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (232.54 KB, 7 trang )

C++ by Dissection
Ira Pohl
University of California
Santa Cruz

Boston San Francisco New York
London Toronto Sydney Tokyo Singapore Madrid
Mexico City Munich Paris Cape Town Hong Kong Montreal


Senior Acquistions Editor
Project Editor
Executive Marketing Manager
Production Supervisor
Project Management
Copyeditor
Proofreader
Composition and Art
Text and Cover Design
Design Manager
Prepress and Manufacturing

Maite Suarez-Rivas
Katherine Harutunian
Michael Hirsch
Marilyn Lloyd
Argosy Publishing
Jeannie Smith
Janet Renard
Debra Dolsberry and Argosy Publishing
Leslie Haimes


Gina Hagen
Hugh Crawford

Access the latest information about Addison-Wesley titles from our World Wide Web site:
/>Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
tradmarks. Where those designations appear in this book, and Addison-Wesley was aware of a trademark
claim, the designations have been printed in initial caps or all caps.
Borland C/C++ is a registered trademark of Borland International, Inc.
GNU C/C++ is a registered trademark of Free Software Foundation, Inc.
Microsoft C/C++ is a registered trademark of Microsoft, Inc.
Turbo C/C++ is a registered trademark of Borland International, Inc.
MS-DOS is a registered trademark of Microsoft, Inc.
OS/2 is a registered trademark of International Business Machines, Inc.
UNIX is a registered trademark licensed through X/Open Company, Ltd.
Windows is a registered trademark of Microsoft, Inc.
FrameMaker is a registered trademark of Frame Technology, Inc.
PostScript is a registered trademark of Adobe Systems, Inc.
The programs and applications presented in this book have been included for their instructional value.
They have been tested with care, but are not guaranteed for any particular purpose. The publisher does
not offer any warranties or representations, nor does it accept any liabilities with respect to the programs or applications.
Library of Congress Cataloging-in-Publication Data
Pohl, Ira
C++ by Dissection / Ira Pohl.
p. cm.
ISBN 0-201-74396-5 (pbk.)
1. C++ (Computer program language) I. Title.
QA76.73.C153 P58 2002
005.13’3--dc21
2001045829
CIP

Copyright © 2002 by Addison-Wesley
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise,
without the prior written permission of the publisher. Printed in the United States of America.
ISBN 0-201-74396-5


About Ira Pohl

Ira Pohl, Ph.D., is a professor of Computer Science at the University of Cali-

fornia, Santa Cruz. He has over 30 years of experience as a software methodologist. His teaching and research interests are in the areas of artificial
intelligence, programming languages, practical complexity problems, heuristic search methods, deductive algorithms, and educational and social
issues. He originated error analysis in heuristic search methods and deductive algorithms.
He is an ACM Fellow and has lectured at Berkeley, Stanford, the Vrije University in Amsterdam, the Courant Institute, Edinburgh University in Scotland, and Auckland University in New Zealand.
When not programming, he enjoys riding bicycles in Aptos, California, with
his wife Debra and daughter Laura.


Other Publications by Ira Pohl
Ira is the sole author of the following Addison-Wesley or Benjamin Cummings publications:
C++ for C Programmers
C++ for Pascal Programmers
C++ for Fortran Programmers
Turbo C++
Object Oriented Programming Using C++
C++ Distilled
Ira is coauthor with Al Kelley for a series of books published by AddisonWesley and Benjamin Cummings on the C programming language:
A Book on C: An Introduction to Programming in C
C by Dissection Turbo C: The Essentials of C Programming
Ira is also coauthor with Charlie McDowell of the following Addison-Wesley

publication:
Java by Dissection: The Essentials of Java Programming
Ira’s first book, coauthored with Alan Shaw, was a pioneering text on computer science (Computer Science Press, 1981):
The Nature of Computation: An Introduction to Computer Science


Dedicated to
Philip Pohl (1932–2001)
who gave me my first computer
(a slide rule).


Ira Pohl’s C++ by Dissection

Illegal Identifiers 28
Keywords 27
Literals 29
Making Change 9
More String Members 459
Operator Precedence and Associativity 46,
453
Range of Floating Point Values 38
Range of Integral Values 38
Standard Files 375
STL Adapted priority_queue Functions 295
STL Adapted queue Functions 295
STL Adapted stack Functions 295
STL Allocator Members 320
STL Arithmetic Function Objects 316
STL Associative Constructors 290

STL Associative Definitions 289
STL Comparison Objects 317
STL Container Definitions 285
STL Container Members 286
STL Function Adaptors 319
STL Insert and Erase Member Functions 290
STL Iterator Adaptors 301
STL Logical Objects 317
STL Member Functions 290
STL Mutating Sequence Library
Functions 308-309
STL Nonmutating Sequence Library
Functions 306-307
STL Numerical Library Functions 312
STL Sequence Members 288
STL Sort Related Library Functions 303-304
STL Sort Related Set Functions 304
Stream State Functions 381
String compare() functions 459
String Comparison Operators 461
String Constructor Members 457
String find() Functions 460
String Literals 29
String More Find Members 460
String Overloaded Global Operators 461
String Overloaded Operator Members 457
String Private Data Members 456
Summing Elements of an Array 108
Trivial Conversions 227
Valid Identifiers 28

tag name 43, 141
template 243-269, 272, 350
argument 261
container 272
function 248
library 280
methodology 357
parameter 270
template 246
templateArray program 261

500

templateStack program 246, 395
terminate() 404, 409
ternary operator 49
test_err program 23
testing 9
text editor 14
this 158, 161
throw 397-398, 405, 408
throw expression 398
Throw Expression Match 404
throw program 398, 400
tio library (Java) 17-19, 414-415, 462
toascii() 381
tokens 26
tolower() 381
top() 295
toupper() 381

tracking program 204
traditional conversion 40
transfer of control 413
transferArray program 243-245
transform() 309
triple program 223
trivial conversion 227
true 27, 47
try 400, 404-405
try block 404
try_me program 392
type
checking 80
conversion 208
declaration 27
derived 25
enumeration 43
extensibility 25, 425-426
generic pointer 104
hierarchy 343
instantiation 246, 260
native 25-44, 207
pointer 75
return 78
safety 90, 127, 272, 425
simple 37
string 99, 455
tag name 43, 141
user-defined 207, 372
type_info library 353

typedef 44
typeid 353
types
bool 37, 47
char 37
class 139, 147, 170, 329
double 37
enum 43
float 37


Ira Pohl’s C++ by Dissection

int 37
long 37
short 37
signed 37
struct 139-141
template 246
union 174, 176, 205
unsigned 37
unsigned char 37
void 104
void* 104
wchar_t 37

U
UML 333
unary one’s complement ^ 176
unary operator overloading 214

unconditional branch 62
unexpected() 408-409
unification 250
union
anonymous 175, 205
initializer 174
member 174
union 174, 176, 205
union program 174
unique() 308-309
unique_copy() 309
UNIX
control-d 16
end-of-file signal 16
unsigned 37
unsigned char 37
upper_bound() 290, 303
user-defined conversion 227
user-defined output 372
user-defined type 207, 372
using 4, 98

V
\v vertical tab 30
variable
global 92
reference 99
vect_it program 263, 265
vector library 280, 283, 285, 293, 297, 300, 307,
311

vertical tab \v 30
vi command 14
virtual
base class 353
inheritance 352
member functions 329
virtual 337
virtual_err program 340
virtual_sel program 338

501

visibility 94, 139
void 104
void* 104
volatile 227

W
wchar_t 37
weekend program 175
while 55
while_test program 55
white space 30-31
widening 41
width of bit field 175
word-parallel operation 176
word_count program 382
write() 367
ws 369


Z
zero 29-30
zero null pointer 197, 353



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×