Cover image for C++ for programmers
Title:
C++ for programmers
Author:
Ammeraal, L. (Leendert)
Personal Author:
Edition:
Third edition.
Publication Information:
New York : Wiley, 2000.
Physical Description:
ix, 453 pages : illustrations ; 24 cm
Language:
English
ISBN:
9780471606970
Format :
Book

Available:*

Library
Call Number
Material Type
Home Location
Status
Item Holds
Searching...
QA76.73.C153 A46 2000 Adult Non-Fiction Central Closed Stacks
Searching...

On Order

Summary

Summary

One of the attractive aspects of C++ is that it offers good facilities for object-oriented programming (OOP), but, as a hybrid language, it also supports procedural programming.
The significance of this for programmers is that it offers more flexibility allowing them to shift to object-oriented programming if and when they feel the need to do so. In this regard, C++ differs from some purely object-oriented languages, such as Smalltalk, Eiffel and Java. This book offers practical guidance on how to programme in both styles.
The C++ language and its standard library have gone through a good many improvements and extensions during their evolution. This third edition has therefore been completely revised in accordance with the C++ language revision, which is embodied in the ANSI/ISO C++ Standard.
For example, the new, important type string is used throughout the book and the Standard Template Library (STL) is introduced to readers at an early stage and discussed in more detail later on. All example programs and the solutions to the exercises can be downloaded from the website. http://home.wxs.nl/ ∼ammeraal/ Solutions for some of these exercises can be found in the appendix.


Author Notes

LEEN AMMERAAL has written several other texts including: STL for C++ Programmers, Algorithms and Data Structures in C++, Computer Graphics for Java Programmers, C for Programmers and Programs and Data Structures in C.


Table of Contents

Prefacep. ix
1 Introductionp. 1
1.1 About C++ and Other Languagesp. 1
1.2 An Unrealistic Programp. 3
1.3 Memory Organization and Binary Numbersp. 7
1.4 Identifiers and Keywordsp. 9
1.5 Literalsp. 10
1.6 The Standard Type stringp. 15
1.7 Some Elements of STLp. 16
1.8 Commentsp. 18
Exercisesp. 19
2 Expressions and Statementsp. 21
2.1 Arithmetic Operationsp. 21
2.2 Types, Variables, and Assignmentsp. 25
2.3 Comparison and Logical Operatorsp. 31
2.4 Compound Statements and If-statementsp. 33
2.5 Iteration Statementsp. 38
2.6 Break, Continue, Goto, Switchp. 42
2.7 Simple Declarationsp. 46
Exercisesp. 47
3 More Operatorsp. 49
3.1 Conditional Expressionsp. 49
3.2 The Comma Operatorp. 51
3.3 Bit Manipulationp. 55
3.4 Simple Arraysp. 58
3.5 Associativityp. 60
3.6 Precedence of Operators and Grammar Rulesp. 62
3.7 Arithmetic Conversions and Castsp. 68
3.8 Lvalues and Rvaluesp. 72
Exercisesp. 75
4 Functions and Program Structurep. 79
4.1 Function Definitions and Declarations; Recursionp. 79
4.2 Keyword void, Global Variables, Namespacesp. 84
4.3 Altering Variables via Parametersp. 91
4.4 Types of Arguments and Return Valuesp. 94
4.5 More about Initializationp. 96
4.6 Separate Compilation and Unnamed Namespacesp. 99
4.7 Some Mathematical Standard Functionsp. 103
4.8 Function Overloadingp. 104
4.9 References as Return Valuesp. 106
4.10 Reference Parameters and constp. 107
4.11 Inline Functionsp. 108
4.12 Some Preprocessor Facilitiesp. 109
Exercisesp. 113
5 Arrays, Pointers, and Stringsp. 117
5.1 Address Arithmeticp. 117
5.2 Function Arguments and Arraysp. 119
5.3 Pointersp. 121
5.4 C-style Strings and the Standard string Typep. 130
5.5 String Constructors and String Assignmentp. 132
5.6 C-style Strings and Conversionp. 134
5.7 Type string: Length, Copy, and Comparep. 138
5.8 Type string: Append, Insert, and Concatenatep. 141
5.9 Type string: Search, Substring, and Swapp. 143
5.10 Type string: Input and Outputp. 144
5.11 Multi-dimensional Arraysp. 145
5.12 Arrays of Pointers and Pointers to Arraysp. 146
5.13 Program Parametersp. 150
5.14 In-memory Format Conversionp. 152
5.15 Pointers to Functionsp. 153
5.16 Dynamic Memory Allocationp. 155
Exercisesp. 159
6 Classes and Objectsp. 161
6.1 The Word structp. 161
6.2 A Constructor and Other Member Functionsp. 163
6.3 Constructor Initializersp. 167
6.4 Member Functions Defined Outside a Classp. 168
6.5 More about Constructorsp. 172
6.6 Operator Overloading and Friend Functionsp. 174
6.7 Operators, Conversion, and the Word explicitp. 181
6.8 Destructor and Default Constructorp. 187
6.9 Copying a Class Objectp. 191
6.10 Inheritancep. 198
6.11 Virtual Functionsp. 209
6.12 Run-time Type Information and dynamic_castp. 217
6.13 Static Class Membersp. 219
6.14 Pointers to Class Membersp. 221
6.15 Unions and Bit Fieldsp. 224
6.16 Function Objectsp. 226
Exercisesp. 231
7 Templatesp. 233
7.1 Introductionp. 233
7.2 Function Templatesp. 233
7.3 Class Templatesp. 237
7.4 Type string Revisitedp. 242
7.5 Complex Numbersp. 243
Exercisesp. 246
8 Exception Handlingp. 247
8.1 Errors and Exceptionsp. 247
8.2 Using the Keywords try, catch, and throwp. 249
8.3 Exception Classesp. 254
8.4 Error Handling with newp. 256
8.5 Exception Specificationsp. 257
Exercisesp. 258
9 Introduction to STLp. 259
9.1 Access to Vectors via Iteratorsp. 259
9.2 Vectors, Lists, Deques; Container Adaptorsp. 262
9.3 Iterator Categoriesp. 271
9.4 Arrays and STL Algorithmsp. 276
9.5 Special Member Functions for Listsp. 279
9.6 Introduction to Associative Containersp. 286
9.7 Sets and Multisetsp. 287
9.8 Maps and Multimapsp. 289
9.9 Pairs and Comparisonsp. 291
9.10 Function Objects and Function Adaptorsp. 294
9.11 Nonmodifying Sequence Algorithmsp. 309
9.12 Modifying Sequence Algorithmsp. 312
9.13 Sorting-related Algorithmsp. 317
9.14 Generalized Numeric Algorithmsp. 329
9.15 Bit Sequences: bitsetp. 331
Exercisesp. 331
10 Stream I/Op. 335
10.1 Streamsp. 335
10.2 Outputp. 336
10.3 Inputp. 346
10.4 File I/Op. 353
10.5 Random Accessp. 360
10.6 Error Statesp. 364
10.7 In-memory Format Conversion Revisitedp. 367
Exercisesp. 368
11 Some Older Library Functionsp. 373
11.1 Diagnostics: [cassert]p. 373
11.2 Character Classification: [cctype]p. 374
11.3 Error Numbers: [cerrno]p. 375
11.4 Floating-point Precision: [cfloat]p. 376
11.5 Maximum Integer, etc.: [climits]p. 377
11.6 Mathematical Functions: [cmath]p. 378
11.7 Variable-length Argument Lists: [cstdarg]p. 380
11.8 Input and Output: [cstdio]p. 381
11.9 Miscellaneous: [cstdlib]p. 391
11.10 C-style String Functions: [cstring]p. 393
11.11 Time and Date: [ctime]p. 395
Exercisesp. 399
Appendix A More about Manipulatorsp. 401
Appendix B Table of ASCII Valuesp. 405
Appendix C Answers to Exercisesp. 407
Bibliographyp. 445
Indexp. 447