- Copyright 2005
- Pages: 912
- Edition: 4th
-
eBook
- ISBN-10: 0-672-33403-8
- ISBN-13: 978-0-672-33403-0
This popular tutorial introduction to standard C++ has been completely updated, reorganized, and rewritten to help programmers learn the language faster and use it in a more modern, effective way.
Just as C++ has evolved since the last edition, so has the authors' approach to teaching it. They now introduce the C++ standard library from the beginning, giving readers the means to write useful programs without first having to master every language detail. Highlighting today's best practices, they show how to write programs that are safe, can be built quickly, and yet offer outstanding performance. Examples that take advantage of the library, and explain the features of C++, also show how to make the best use of the language. As in its previous editions, the book's authoritative discussion of fundamental C++ concepts and techniques makes it a valuable resource even for more experienced programmers.
Program Faster and More Effectively with This Rewritten Classic
- Restructured for quicker learning, using the C++ standard library
- Updated to teach the most current programming styles and program design techniques
- Filled with new learning aids that emphasize important points, warn about common pitfalls, suggest good programming practices, and provide general usage tips
- Complete with exercises that reinforce skills learned
- Authoritative and comprehensive in its coverage
The source code for the book's extended examples is available on the Web at the address below.
Table of Contents
Preface xix
Chapter 1. Getting Started 1
- 1.1 Writing a Simple C++ Program 2
- 1.2 A First Look at Input/Output 5
- 1.3 A Word About Comments 10
- 1.4 Control Structures 11
- 1.5 Introducing Classes 20
- 1.6 The C++ Program 25
- Chapter Summary 28
- Defined Terms 28
Part I. The Basics 31
Chapter 2. Variables and Basic Types 33
- 2.1 Primitive Built-in Types 34
- 2.2 Literal Constants 37
- 2.3 Variables 43
- 2.4 const Qualifier 56
- 2.5 References 58
- 2.6 Typedef Names 61
- 2.7 Enumerations 62
- 2.8 Class Types 63
- 2.9 Writing Our Own Header Files 67
- Chapter Summary 73
- Defined Terms 73
Chapter 3. Library Types 77
- 3.1 Namespace using Declarations 78
- 3.2 Library string Type 80
- 3.3 Library vector Type 90
- 3.4 Introducing Iterators 95
- 3.4.1 Iterator Arithmetic 100
- 3.5 Library bitset Type 101
- Chapter Summary 107
- Defined Terms 107
Chapter 4. Arrays and Pointers 109
- 4.1 Arrays 110
- 4.2 Introducing Pointers 114
- 4.3 C-Style Character Strings 130
- 4.4 Multidimensioned Arrays 141
- Chapter Summary 145
- Defined Terms 145
Chapter 5. Expressions 147
- 5.1 Arithmetic Operators 149
- 5.2 Relational and Logical Operators 152
- 5.3 The Bitwise Operators 154
- 5.4 Assignment Operators 159
- 5.5 Increment and Decrement Operators 162
- 5.6 The Arrow Operator 164
- 5.7 The Conditional Operator 165
- 5.8 The size of Operator 167
- 5.9 Comma Operator 168
- 5.10 Evaluating Compound Expressions 168
- 5.11 The new and delete Expressions 174
- 5.12 Type Conversions 178
- Chapter Summary 188
- Defined Terms 188
Chapter 6. Statements 191
- 6.1 Simple Statements 192
- 6.2 Declaration Statements 193
- 6.3 Compound Statements (Blocks) 193
- 6.4 Statement Scope 194
- 6.5 The if Statement 195
- 6.5.1 The if Statement else Branch 197
- 6.6 The switch Statement 199
- 6.7 The whileStatement 204
- 6.8 The for Loop Statement 207
- 6.9 The do while Statement 210
- 6.10 The break Statement