Preface | p. xv |
The Basics | |
What Is C++? | p. 3 |
A Brief History of C++ | p. 3 |
C++ Organization | p. 4 |
How to Learn C++ | p. 6 |
The Basics of Program Writing | p. 7 |
Programs from Conception to Execution | p. 9 |
Creating a Real Program | p. 10 |
Getting Help in Unix | p. 22 |
Getting Help in an IDE | p. 22 |
Style | p. 23 |
Comments | p. 24 |
C++ Code | p. 28 |
Naming Style | p. 30 |
Coding Religion | p. 31 |
Indentation and Code Format | p. 31 |
Clarity | p. 32 |
Simplicity | p. 33 |
Consistency and Organization | p. 34 |
Basic Declarations and Expressions | p. 35 |
Basic Program Structure | p. 36 |
Simple Expressions | p. 37 |
The std::cout Output Object | p. 38 |
Variables and Storage | p. 39 |
Variable Declarations | p. 40 |
Integers | p. 40 |
Assignment Statements | p. 41 |
Floating-Point Numbers | p. 42 |
Floating-Point Divide Versus Integer Divide | p. 43 |
Characters | p. 44 |
Wide Characters | p. 46 |
Boolean Type | p. 46 |
Arrays, Qualifiers, and Reading Numbers | p. 48 |
Arrays | p. 48 |
Strings | p. 49 |
Reading Data | p. 51 |
Initializing Variables | p. 53 |
Multidimensional Arrays | p. 57 |
C-Style Strings | p. 58 |
Types of Integers | p. 64 |
Types of Floats | p. 67 |
Constant and Reference Declarations | p. 67 |
Qualifiers | p. 68 |
Hexadecimal and Octal Constants | p. 70 |
Operators for Performing Shortcuts | p. 71 |
Side Effects | p. 72 |
Decision and Control Statements | p. 76 |
if Statement | p. 76 |
else Statement | p. 77 |
How Not to Use std::strcmp | p. 78 |
Looping Statements | p. 79 |
while Statement | p. 79 |
break Statement | p. 81 |
continue Statement | p. 82 |
The Assignment Anywhere Side Effect | p. 83 |
The Programming Process | p. 87 |
Setting Up Your Work Area | p. 89 |
The Specification | p. 90 |
Code Design | p. 91 |
The Prototype | p. 92 |
The Makefile | p. 93 |
Testing | p. 96 |
Debugging | p. 96 |
Maintenance | p. 98 |
Revisions | p. 99 |
Electronic Archaeology | p. 99 |
Mark Up the Program | p. 100 |
Use the Debugger | p. 100 |
Use the Text Editor as a Browser | p. 100 |
Add Comments | p. 101 |
Simple Programming | |
More Control Statements | p. 107 |
for Statement | p. 107 |
switch Statement | p. 110 |
switch, break, and continue | p. 115 |
Variable Scope and Functions | p. 118 |
Scope and Storage Class | p. 118 |
Namespaces | p. 122 |
Functions | p. 125 |
Summary of Parameter Types | p. 138 |
Recursion | p. 139 |
Structured Programming Basics | p. 141 |
Real-World Programming | p. 142 |
The C++ Preprocessor | p. 145 |
#define Statement | p. 145 |
Conditional Compilation | p. 150 |
#include Files | p. 152 |
Parameterized Macros | p. 154 |
Advanced Features | p. 156 |
Bit Operations | p. 160 |
Bit Operators | p. 161 |
The AND Operator (&) | p. 161 |
Bitwise OR ( ) | p. 163 |
The Bitwise Exclusive OR ([logical and) | p. 164 |
The Ones Complement Operator (NOT) | p. 164 |
The Left and Right Shift Operators ([double left angle bracket], [double right angle bracket]) | p. 165 |
Setting, Clearing, and Testing Bits | p. 166 |
Bitmapped Graphics | p. 169 |
Advanced Types and Classes | |
Advanced Types | p. 179 |
Structures | p. 179 |
Unions | p. 181 |
typedef | p. 184 |
enum Type | p. 185 |
Bit Members or Packed Structures | p. 186 |
Arrays of Structures | p. 188 |
Simple Classes | p. 191 |
Stacks | p. 191 |
Improved Stack | p. 195 |
Using a Class | p. 197 |
Introduction to Constructors and Destructors | p. 199 |
Automatically Generated Member Functions | p. 204 |
Shortcuts | p. 205 |
Style | p. 206 |
Structures Versus Classes | p. 208 |
More on Classes | p. 211 |
Friends | p. 211 |
Constant Functions | p. 213 |
Constant Members | p. 215 |
Static Member Variables | p. 216 |
Static Member Functions | p. 218 |
The Meaning of static | p. 218 |
Simple Pointers | p. 221 |
const Pointers | p. 226 |
Pointers and Printing | p. 226 |
Pointers and Arrays | p. 227 |
The reinterpret_cast | p. 234 |
Pointers and Structures | p. 234 |
Command-Line Arguments | p. 235 |
Advanced Programming Concepts | |
File Input/Output | p. 245 |
C++ File I/O | p. 245 |
Conversion Routines | p. 250 |
Binary and ASCII Files | p. 254 |
The End-of-Line Puzzle | p. 255 |
Binary I/O | p. 256 |
Buffering Problems | p. 257 |
Unbuffered I/O | p. 258 |
Designing File Formats | p. 262 |
C-Style I/O Routines | p. 264 |
C-Style Conversion Routines | p. 266 |
C-Style Binary I/O | p. 270 |
C- Versus C++- Style I/O | p. 272 |
Debugging and Optimization | p. 277 |
Code Reviews | p. 277 |
Serial Debugging | p. 280 |
Going Through the Output | p. 282 |
Interactive Debuggers | p. 283 |
Debugging a Binary Search | p. 287 |
Interactive Debugging Tips and Tricks | p. 298 |
Runtime Errors | p. 299 |
Optimization | p. 301 |
How to Optimize | p. 306 |
Case Study: Inline Functions Versus Normal Functions | p. 308 |
Case Study: Optimizing a Color-Rendering Algorithm | p. 308 |
Operator Overloading | p. 310 |
Creating a Simple Fixed-Point Class | p. 310 |
Operator Functions | p. 315 |
Operator Member Functions | p. 324 |
Warts | p. 326 |
Full Definition of the Fixed-Point Class | p. 326 |
Floating Point | p. 337 |
Floating-Point Format | p. 337 |
Floating Addition/Subtraction | p. 338 |
Multiplication and Division | p. 339 |
Overflow and Underflow | p. 340 |
Roundoff Error | p. 340 |
Accuracy | p. 341 |
Minimizing Roundoff Error | p. 342 |
Determining Accuracy | p. 342 |
Precision and Speed | p. 343 |
Power Series | p. 344 |
Advanced Pointers | p. 347 |
Pointers, Structures, and Classes | p. 348 |
delete Operator | p. 350 |
Linked Lists | p. 351 |
Ordered Linked Lists | p. 354 |
Doubly Linked Lists | p. 357 |
Trees | p. 360 |
Printing a Tree | p. 364 |
The Rest of the Program | p. 364 |
Data Structures for a Chess Program | p. 367 |
Advanced Classes | p. 371 |
Derived Classes | p. 371 |
Virtual Functions | p. 378 |
Virtual Classes | p. 383 |
Function Hiding in Derived Classes | p. 385 |
Constructors and Destructors in Derived Classes | p. 385 |
The dynamic_cast Operator | p. 388 |
Other Language Features | |
Exceptions | p. 393 |
Adding Exceptions to the Stack Class | p. 394 |
Exceptions Versus assert | p. 400 |
Modular Programming | p. 401 |
Modules | p. 401 |
Public and Private | p. 402 |
The extern Storage Class | p. 402 |
Headers | p. 404 |
The Body of the Module | p. 406 |
A Program to Use Infinite Arrays | p. 406 |
The Makefile for Multiple Files | p. 408 |
Using the Infinite Array | p. 412 |
Dividing a Task into Modules | p. 417 |
Module Design Guidelines | p. 417 |
Templates | p. 419 |
What Is a Template? | p. 419 |
Templates: The Hard Way | p. 419 |
Templates: The C++ Way | p. 420 |
Function Specialization | p. 423 |
Class Templates | p. 424 |
Class Specialization | p. 426 |
Implementation Details | p. 426 |
Advanced Features | p. 429 |
Standard Template Library | p. 432 |
STL Basics | p. 432 |
Class List--A Set of Students | p. 434 |
Creating a Waiting List with the STL List | p. 436 |
Storing Grades in a STL Map | p. 437 |
Putting It All Together | p. 437 |
Practical Considerations When Using the STL | p. 445 |
Getting More Information | p. 446 |
Program Design | p. 448 |
Design Goals | p. 448 |
Design Factors | p. 449 |
Design Principles | p. 450 |
Coding | p. 451 |
Objects | p. 457 |
Real-World Design Techniques | p. 461 |
Putting It All Together | p. 469 |
Requirements | p. 469 |
Code Design | p. 471 |
Coding | p. 472 |
Functional Description | p. 472 |
Testing | p. 477 |
Revisions | p. 477 |
A Final Warning | p. 477 |
Program Files | p. 477 |
From C to C++ | p. 497 |
K&R-Style Functions | p. 497 |
struct | p. 498 |
malloc and free | p. 498 |
Turning Structures into Classes | p. 500 |
setjmp and longjmp | p. 501 |
Mixing C and C++ Code | p. 503 |
C++'s Dustier Corners | p. 504 |
do/while | p. 504 |
goto | p. 504 |
The?: Construct | p. 506 |
The Comma Operator | p. 506 |
Overloading the () Operator | p. 507 |
Pointers to Members | p. 507 |
The asm Statement | p. 508 |
The mutable Qualifier | p. 508 |
Run Time Type Identification | p. 509 |
Trigraphs | p. 509 |
Programming Adages | p. 510 |
General | p. 510 |
Design | p. 511 |
Declarations | p. 511 |
switch Statement | p. 511 |
Preprocessor | p. 511 |
Style | p. 512 |
Compiling | p. 512 |
The Ten Commandments for C++ Programmers | p. 512 |
Final Note | p. 513 |
Appendixes | |
ASCII Table | p. 517 |
Ranges | p. 519 |
Operator Precedence Rules | p. 521 |
Computing Sine Using a Power Series | p. 523 |
Resources | p. 529 |
Index | p. 531 |
Table of Contents provided by Syndetics. All Rights Reserved. |
The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.
The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.