-
The Basics
-
Chapter 1 What Is C++?
- A Brief History of C++
- C++ Organization
- How to Learn C++
-
Chapter 2 The Basics of Program Writing
- Programs from Conception to Execution
- Creating a Real Program
- Getting Help in Unix
- Getting Help in an IDE
- Programming Exercises
-
Chapter 3 Style
- Comments
- C++ Code
- Naming Style
- Coding Religion
- Indentation and Code Format
- Clarity
- Simplicity
- Consistency and Organization
- Further Reading
- Summary
-
Chapter 4 Basic Declarations and Expressions
- Basic Program Structure
- Simple Expressions
- The std::cout Output Object
- Variables and Storage
- Variable Declarations
- Integers
- Assignment Statements
- Floating-Point Numbers
- Floating-Point Divide Versus Integer Divide
- Characters
- Wide Characters
- Boolean Type
- Programming Exercises
- Answers to Chapter Questions
-
Chapter 5 Arrays, Qualifiers, and Reading Numbers
- Arrays
- Strings
- Reading Data
- Initializing Variables
- Multidimensional Arrays
- C-Style Strings
- Types of Integers
- Types of Floats
- Constant and Reference Declarations
- Qualifiers
- Hexadecimal and Octal Constants
- Operators for Performing Shortcuts
- Side Effects
- Programming Exercises
- Answers to Chapter Questions
-
Chapter 6 Decision and Control Statements
- if Statement
- else Statement
- How Not to Use std::strcmp
- Looping Statements
- while Statement
- break Statement
- continue Statement
- The Assignment Anywhere Side Effect
- Programming Exercises
- Answers to Chapter Questions
-
Chapter 7 The Programming Process
- Setting Up Your Work Area
- The Specification
- Code Design
- The Prototype
- The Makefile
- Testing
- Debugging
- Maintenance
- Revisions
- Electronic Archaeology
- Mark Up the Program
- Use the Debugger
- Use the Text Editor as a Browser
- Add Comments
- Programming Exercises
-
-
Simple Programming
-
Chapter 8 More Control Statements
- for Statement
- switch Statement
- switch, break, and continue
- Programming Exercises
- Answers to Chapter Questions
-
Chapter 9 Variable Scope and Functions
- Scope and Storage Class
- Namespaces
- Functions
- Summary of Parameter Types
- Recursion
- Structured Programming Basics
- Real-World Programming
- Programming Exercises
- Answers to Chapter Questions
-
Chapter 10 The C++ Preprocessor
- #define Statement
- Conditional Compilation
- #include Files
- Parameterized Macros
- Advanced Features
- Summary
- Programming Exercises
- Answers to Chapter Questions
-
Chapter 11 Bit Operations
- Bit Operators
- The AND Operator (&)
- Bitwise OR (|)
- The Bitwise Exclusive OR (^)
- The Ones Complement Operator (NOT) (~)
- The Left and Right Shift Operators (<<, >>)
- Setting, Clearing, and Testing Bits
- Bitmapped Graphics
- Programming Exercises
- Answers to Chapter Questions
-
-
Advanced Types and Classes
-
Chapter 12 Advanced Types
- Structures
- Unions
- typedef
- enum Type
- Bit Members or Packed Structures
- Arrays of Structures
- Programming Exercises
- Answers to Chapter Questions
-
Chapter 13 Simple Classes
- Stacks
- Improved Stack
- Using a Class
- Introduction to Constructors and Destructors
- Automatically Generated Member Functions
- Shortcuts
- Style
- Structures Versus Classes
- Programming Exercises
-
Chapter 14 More on Classes
- Friends
- Constant Functions
- Constant Members
- Static Member Variables
- Static Member Functions
- The Meaning of static
- Programming Exercises
-
Chapter 15 Simple Pointers
- const Pointers
- Pointers and Printing
- Pointers and Arrays
- The reinterpret_cast
- Pointers and Structures
- Command-Line Arguments
- Programming Exercises
- Answers to Chapter Questions
-
-
Advanced Programming Concepts
-
Chapter 16 File Input/Output
- C++ File I/O
- Conversion Routines
- Binary and ASCII Files
- The End-of-Line Puzzle
- Binary I/O
- Buffering Problems
- Unbuffered I/O
- Designing File Formats
- C-Style I/O Routines
- C-Style Conversion Routines
- C-Style Binary I/O
- C- Versus C++- Style I/O
- Programming Exercises
- Answers to Chapter Questions
-
Chapter 17 Debugging and Optimization
- Code Reviews
- Serial Debugging
- Going Through the Output
- Interactive Debuggers
- Debugging a Binary Search
- Interactive Debugging Tips and Tricks
- Runtime Errors
- Optimization
- How to Optimize
- Case Study: Inline Functions Versus Normal Functions
- Case Study: Optimizing a Color-Rendering Algorithm
- Programming Exercises
- Answers to Chapter Questions
-
Chapter 18 Operator Overloading
- Creating a Simple Fixed-Point Class
- Operator Functions
- Operator Member Functions
- Warts
- Full Definition of the Fixed-Point Class
- Programming Exercises
- Answers to Chapter Questions
-
Chapter 19 Floating Point
- Floating-Point Format
- Floating Addition/Subtraction
- Multiplication and Division
- Overflow and Underflow
- Roundoff Error
- Accuracy
- Minimizing Roundoff Error
- Determining Accuracy
- Precision and Speed
- Power Series
- Programming Exercises
-
Chapter 20 Advanced Pointers
- Pointers, Structures, and Classes
- delete Operator
- Linked Lists
- Ordered Linked Lists
- Doubly Linked Lists
- Trees
- Printing a Tree
- The Rest of the Program
- Data Structures for a Chess Program
- Programming Exercises
- Answers to Chapter Questions
-
Chapter 21 Advanced Classes
- Derived Classes
- Virtual Functions
- Virtual Classes
- Function Hiding in Derived Classes
- Constructors and Destructors in Derived Classes
- The dynamic_cast Operator
- Summary
- Programming Exercises
- Answers to Chapter Questions
-
-
Other Language Features
-
Chapter 22 Exceptions
- Adding Exceptions to the Stack Class
- Exceptions Versus assert
- Programming Exercises
-
Chapter 23 Modular Programming
- Modules
- Public and Private
- The extern Storage Class
- Headers
- The Body of the Module
- A Program to Use Infinite Arrays
- The Makefile for Multiple Files
- Using the Infinite Array
- Dividing a Task into Modules
- Module Design Guidelines
- Programming Exercises
-
Chapter 24 Templates
- What Is a Template?
- Templates: The Hard Way
- Templates: The C++ Way
- Function Specialization
- Class Templates
- Class Specialization
- Implementation Details
- Advanced Features
- Summary
- Programming Exercises
-
Chapter 25 Standard Template Library
- STL Basics
- Class List—A Set of Students
- Creating a Waiting List with the STL List
- Storing Grades in a STL Map
- Putting It All Together
- Practical Considerations When Using the STL
- Getting More Information
- Exercises
-
Chapter 26 Program Design
- Design Goals
- Design Factors
- Design Principles
- Coding
- Objects
- Real-World Design Techniques
- Conclusion
-
Chapter 27 Putting It All Together
- Requirements
- Code Design
- Coding
- Functional Description
- Testing
- Revisions
- A Final Warning
- Program Files
- Programming Exercises
-
Chapter 28 From C to C++
- K&R-Style Functions
- struct
- malloc and free
- Turning Structures into Classes
- setjmp and longjmp
- Mixing C and C++ Code
- Summary
- Programming Exercise
-
Chapter 29 C++'s Dustier Corners
- do/while
- goto
- The ?: Construct
- The Comma Operator
- Overloading the ( ) Operator
- Pointers to Members
- The asm Statement
- The mutable Qualifier
- Run Time Type Identification
- Trigraphs
- Answers to Chapter Questions
-
Chapter 30 Programming Adages
- General
- Design
- Declarations
- switch Statement
- Preprocessor
- Style
- Compiling
- The Ten Commandments for C++ Programmers
- Final Note
- Answers to Chapter Questions
-
-
Appendixes
-
Appendix A ASCII Table
-
Appendix B Ranges
-
Appendix C Operator Precedence Rules
- Standard Rules
- Practical Subset of the Operator Precedence Rules
-
Appendix D Computing Sine Using a Power Series
-
Appendix E Resources
- Compilers
- Standard Template Library
- Standards
- Programming Tools
-
-
Colophon
- Title:
- Practical C++ Programming, Second Edition
- By:
- Steve Oualline
- Publisher:
- O'Reilly Media
- Formats:
-
- Ebook
- Safari Books Online
- Print Release:
- December 2002
- Ebook Release:
- June 2009
- Pages:
- 576
- Print ISBN:
- 978-0-596-00419-4
- | ISBN 10:
- 0-596-00419-2
- Ebook ISBN:
- 978-0-596-10352-1
- | ISBN 10:
- 0-596-10352-2
Our look is the result of reader comments, our own experimentation, and feedback from distribution channels. Distinctive covers complement our distinctive approach to technical topics, breathing personality and life into potentially dry subjects. The animal on the cover of Practical C++ Programming is an Eastern chipmunk, a striped ground squirrel found mostly in eastern North America. Eastern chipmunks have five dark and two light stripes on their backs, extending from head to rump, and two stripes on their long, bushy tails. They are distinguished from other ground squirrels by the white stripes above and below their eyes. The coloration of chipmunks throughout North America varies, but is quite uniform within regions.
Chipmunks often make their homes in sparse forests or farms, where they can build the entrances to their lodges in stone walls, broken trees, or thick underbrush. The lodges consist of a maze of tunnels leading to a large leaf-lined nest. Chipmunks spend most of the daylight hours outdoors, but head for their lodges before nightfall. Although they are excellent climbers, chipmunks live primarily on the ground.
Chipmunks eat nuts, seeds, insects, and occasionally birds' eggs. Like all ground squirrels, they have large cheek pouches, sometimes extending as far back as their shoulders, in which they can store food. They collect and store nuts and seeds through the summer and fall. When the weather starts to get cool, all the chipmunks in a region will suddenly disappear into their lodges where they begin hibernation. On warm winter days one can often see chipmunk pawprints in the snow, as they will sometimes wake up and leave their lodges for brief periods when the temperature rises.
Mating season for Eastern chipmunks is mid-March to early April. The gestation period is 31 days, after which a litter of three to six is born. Baby chipmunks leave the lodge after one month, and are mature by July.
The chipmunk most likely got its name from the noise it makes, which sounds like a loud "cheep." You can occasionally see a chipmunk hanging upside down from a tree branch "cheeping" its call. Edie Freedman designed the cover of this book, using a 19th-century engraving from the Dover Pictorial Archive. Emma Colby produced the cover layout with Quark XPress 4.1 using the ITC Garamond font.
David Futato designed the interior layout. Mike Sierra polished the final book files in FrameMaker 5.5.6. Leanne Soylemez copyedited the text. Octal Publishing, Inc., prepared the index. Jane Ellin provided quality control and production guidance.
The text font is Lintotype Birka; the heading font is Adobe Myriad Condensed; and the code font is LucasFont's TheSans Mono Condensed.The illustrations that appear in the book were created by Robert Romano and Jessamyn Read using Macromedia FreeHand 9 and Adobe Photoshop 6. The tip and warning icons were drawn by Christopher Bing. This colophon was written by Clairemarie Fisher O'Leary.
