Table of contents for Prata's CPP Primer Plus (6th ed)


Index p.1367

CIS 244 Coverage: 1, 2, 3, 4, 5, 6, 7, 8


CHAPTER 1: Getting Started 9

Learning C++: What Lies Before You The Origins of C++: A Little History The C Language C Programming Philosophy The C++ Shift: Object-Oriented Programming C++ and Generic Programming The Genesis of C++ Portability and Standards The Mechanics of Creating a Program Creating the Source Code File Compilation and Linking

Chapter 2 Setting Out to C++ 27

C++ Initiation The main() Function C++ Comments The C++ Preprocessor and the iostream File Header Filenames Namespaces C++ Output with cout C++ Source Code Formatting C++ Statements Declaration Statements and Variables Assignment Statements A New Trick for cout More C++ Statements Using cin Concatenating with cout cin and cout: A Touch of Class Functions Using a Function That Has a Return Value Function Variations User-Defined Functions Using a User-Defined Function That Has a Return Value Placing the using Directive in Multifunction Programs

Chapter 3 Dealing with Data 65

Simple Variables Names for Variables Integer Types The short, int, and long Integer Types Unsigned Types Choosing an Integer Type Integer Constants How C++ Decides What Type a Constant Is The char Type: Characters and Small Integers The bool Type The const Qualifier Floating-Point Numbers Writing Floating-Point Numbers Floating-Point Types Floating-Point Constants Advantages and Disadvantages of Floating-Point Numbers C++ Arithmetic Operators Order of Operation: Operator Precedence and Associativity Division Diversions The Modulus Operator Type Conversions

Chapter 4 Compound Types 115

Introducing Arrays Program Notes Initialization Rules for Arrays Strings Concatenating String Constants Using Strings in an Array Adventures in String Input Reading String Input a Line at a Time Mixing String and Numeric Input Introducing the string Class Assignment, Concatenation, and Appending More string Class Operations More on string Class I/O Introducing Structures Using a Structure in a Program Can a Structure Use a string Class Member? Other Structure Properties Arrays of Structures Bit Fields in Structures Unions Enumerations Setting Enumerator Values Value Ranges for Enumerations Pointers and the Free Store Declaring and Initializing Pointers Pointer Danger Pointers and Numbers Allocating Memory with new Freeing Memory with delete Using new to Create Dynamic Arrays Pointers, Arrays, and Pointer Arithmetic Program Notes Pointers and Strings Using new to Create Dynamic Structures Automatic Storage, Static Storage, and Dynamic Storage

Chapter 5 Loops and Relational Expressions 195

Introducing for Loops for Loop Parts Back to the for Loop Changing the Step Size Inside Strings with the for Loop The Increment (++) and Decrement (--) Operators Side Effects and Sequence Points Prefixing Versus Postfixing The Increment/Decrement Operators and Pointers Combination Assignment Operators Compound Statements, or Blocks The Comma Operator (or More Syntax Tricks) Relational Expressions A Mistake You’ll Probably Make Comparing C-Style Strings Comparing string Class Strings The while Loop Program Notes for Versus while Just a Moment—Building a Time-Delay Loop The do while Loop Loops and Text Input Using Unadorned cin for Input cin.get(char) to the Rescue Which cin.get()? The End-of-File Condition Yet Another Version of cin.get() Nested Loops and Two-Dimensional Arrays Initializing a Two-Dimensional Array

Chapter 6 Branching Statements and Logical Operators 253

The if Statement The if else Statement Formatting if else Statements The if else if else Construction Logical Expressions The Logical OR Operator: || The Logical AND Operator: && The Logical NOT Operator: ! Logical Operator Facts Alternative Representations The cctype Library of Character Functions The ?: Operator The switch Statement Using Enumerators as Labels switch and if else The break and continue Statements Program Notes Number-Reading Loops Program Notes Simple File Input/Output Text I/O and Text Files Writing to a Text File Reading from a Text File

Chapter 7 Functions: C++’s Programming Modules 305

Function Review Defining a Function Prototyping and Calling a Function Function Arguments and Passing by Value Multiple Arguments Another Two-Argument Function Functions and Arrays How Pointers Enable Array-Processing Functions The Implications of Using Arrays as Arguments More Array Function Examples Functions Using Array Ranges Pointers and const Functions and Two-Dimensional Arrays Functions and C-Style Strings Functions with C-Style String Arguments Functions That Return C-Style Strings Functions and Structures Passing and Returning Structures Another Example of Using Functions with Structures Passing Structure Addresses Functions and string Class Objects Recursion Recursion with a Single Recursive Call Recursion with Multiple Recursive Calls Pointers to Functions Function Pointer Basics A Function Pointer Example

Chapter 8 Adventures in Functions 379

C++ Inline Functions Reference Variables Creating a Reference Variable References as Function Parameters Reference Properties and Oddities Using References with a Structure Using References with a Class Object Another Object Lesson: Objects, Inheritance, and References When to Use Reference Arguments Default Arguments Program Notes Function Overloading An Overloading Example When to Use Function Overloading Function Templates Overloaded Templates Explicit Specializations Instantiations and Specializations Which Function Version Does the Compiler Pick?

Chapter 9 Memory Models and Namespaces 447

Separate Compilation 447 Storage Duration, Scope, and Linkage 453 Namespaces 482

Chapter 10 Objects and Classes

Procedural and Object-Oriented Programming 506 Abstraction and Classes 507 Class Constructors and Destructors 524 Knowing Your Objects: The this Pointer 539 An Array of Objects 546 Class Scope 549 Abstract Data Types 552

Chapter 11 Working with Classes

Chapter 12 Classes and Dynamic Memory Allocation