Bibliographic record and links to related information available from the Library of Congress catalog
Note: Electronic data is machine generated. May be incomplete or contain other coding.
Chapter 1: Creating a Basic Program 1 Basic C++ Syntax ............................ 2 Compiling a C++ Program ................... 6 Printing Text ............................... 10 Running a Compiled Program ................. 14 Pausing Execution ........................... 16 Understanding White Space .................. 18 Adding Comments to Your Source Code ....... 20 Using an IDE .......................... 23 Chapter 2: Simple Variables and Data Types 29 Declaring Variables .......................... 30 Assigning Values to Variables ................ 36 Printing Variables ...................... . 38 Formatting Numbers...... ................. 41 Understanding Type Conversion............... 44 Introduction to Characters ................... 48 Introduction to Strings .......................51 Introduction to Constants .................... 54 Chapter 3: Operators and Control Structures 57 Arithmetic Operators........................58 if Conditionals .................. ........... 64 Using else and else if ......................... 68 The Ternary Operator ....................... 72 Logical and Comparison Operators ............ 76 Switch Conditionals .......................... 82 Increment and Decrement Operators .......... 88 While Loop. ............. ............. 92 For Loop .................... ............. 96 Chapter 4: Input, Output, and Files 99 Taking Character Input......................... 100 Discarding Input ........................ . 105 Taking Numeric Input ...................... 108 Taking String Input ......................... 111 Taking Multiple Inputs ................... 114 Reading In a Whole Line................... 118 Validating Input .................. ...........121 Creating File Output ........................ 127 Using File Input ............................ 132 Chapter 5: Defining Your Own Functions 137 Creating Simple Functions ................... 138 Creating Functions That Take Arguments..... 143 Setting Default Argument Values............ 149 Creating Functions That Return a Value ...... 154 Overloading Functions ........... ........ . 160 Understanding Variable Scope ............... 164 Chapter 6: Complex Data Types 169 Working with Arrays ...................... 170 Working with Pointers..................... 176 Structures................................ 194 Revisiting User-Defined Functions............ 199 Chapter 7: Introducing Objects 207 Creating a Simple Class .......... ........... 208 Adding Methods to a Class .................. 212 Creating and Using Objects .................. 217 Defining Constructors....................... 221 Defining Destructors....................... 226 The this Pointer ............................ 232 Chapter 8: Class Inheritance 237 Basic Inheritance ...........................238 Inheriting Constructors and Destructors...... 244 Access Control.............................. 249 Overriding Methods. ....... ................ 254 Overloading Methods ..................... 258 Making Friends ............................. 261 Chapter 9: Advanced OOP 267 Static Attributes and Methods ............... 268 Virtual Methods ............................ 275 Abstract Methods ......................... 283 Operator Overloading ....................... 288' The << Operator ....................... 296 Multiple Inheritance ...................... 301 Virtual Inheritance ......... ................ 308 Chapter lo: Error Handling and Debugging 313 Debugging Techniques ..................... 314 Returning Error Codes...................... 320 Using assert() ............................. 326 Catching Exceptions .........................332 Chapter 11: Dynamic Memory Management 339 Static and Dynamic Memory................ 340 Allocating Objects ...........................344 Allocating Arrays of Dynamic Size............ 349 Returning Memory from a Function or Method ........................... 354 The Copy Constructor and the Assignment O perator ............................... 359 Static Object Type Casts.................... 368 Performing Dynamic Object Type Casts....... 372 Avoiding Memory Leaks ................. 376 Chapter 12: Namespaces & Modularization 379 Working with Included Files ................. 380 The C Preprocessor .......................... 394 Understanding Namespaces ............... 398 Linkage and Scope ........................ 406 Chapter 13: Working with Templates 415 Basic Template Syntax ...................... 416 Creating Inline Templates ................... 428 Containers and Algorithms ................ 432 Chapter 14: Extended Topics 443 Strings Revisited ........................... 444 Working with Binary Files ................... 458 Taking Command-Line Arguments .........473