Preface: -- We'll have fun, fun, fun -- Why C and C++ -- C++: how to "think objects" -- Purpose of the third edition -- Where do I begin? -- Icons and more icons -- Anything not covered? -- Final note: have fun! -- Acknowledgments -- About the author -- Start Using C++: -- Install Microsoft Visual Studio -- Create a project with Microsoft -- Writing a program in Microsoft Visual Studio -- Running a program in Visual Studio -- Compatibility issue #1: stdafx-h -- Compatibility Issue #2: Pausing the screen -- If You're Not Using Microsoft: -- Example 1-1: Print A Message: -- How it works -- Exercises -- Interlude: What about the #include and using? -- Advancing To The Next Print Line: -- Example 1-2: Print Multiple Lines -- How it works -- Exercises -- Interlude: What is a String? -- Storing Data: C++ variables -- Introduction to data types -- Interlude: Why double precision, not single? -- Example 1-3: Convert Temperature -- How it works -- Optimizing the program -- Exercises -- Word about variable names and keywords -- Exercise -- Chapter 1 summary -- Decisions, Decisions: -- But first, a few words about data types -- Decision making in programs -- Interlude: What about Artificial Intelligence (AI)? -- If and if-else -- Interlude: Why two operators (= and ==)? -- Example 2-1: Odd Or Even -- How it works -- Optimizing the code -- Exercise -- Introducing Loops: -- Interlude: Infinite Loopiness: -- Example 2-2: Print 1 To N -- How it works -- Optimizing the program -- Exercises -- True And False In C++: -- Interlude: Bool Data Type -- Increment operator (++) -- Statements versus expressions -- Introducing Boolean (short-circuit) Logic: -- Interlude: What is "true"? -- Example 2-3: Testing A Person's Age: -- How it works -- Exercise -- Introducing The Math Library: -- Example 2-4: Prime-Number Test -- How it works -- Optimizing the program -- Exercise -- Example 2-5: Subtraction Game (NIM) -- How it works -- Exercises -- Chapter 2 summary -- Even More Decisions!: -- Do-While Loop: -- Example 3-1: Adding Machine -- How it works -- Exercises -- Introducing Random Numbers: -- Example 3-2: Guess-The-Number Game -- How it works -- Optimizing the code -- Exercises -- Switch-Case Statement: -- Example 3-3: Print A Number -- How it works -- Exercises -- Chapter 3 summary -- Handy, All-Purpose "For" Statement: -- Loops used for counting -- Introducing the "for" loop -- Wealth Of Examples: -- Interlude: Does "for" always behave like "while"? -- Example 4-1: Printing 1 To N With "For" -- How it works -- Exercises -- Declaring Loop Variables "On The Fly": -- Example 4-2: Prime-Number Test With "For" -- How it works -- Exercise -- Comparative languages 101: the basic "For" statement -- Chapter 4 summary -- Functions: Many Are Called: -- Concept of function -- Basics Of Using Functions: -- Step 1: Declare (prototype) the function -- Step 2: Define the function -- Step 3: Call the function -- Example 5-1: Avg() Function -- How it works -- Function, call a function! -- Exercises -- Example 5-2: Prime-Number Function -- How it works -- Exercises -- Local And Global Variables: -- Interlude: Why global variables at all? -- Recursive Functions: -- Example 5-3: Prime Factorization -- How it works -- Interlude: Interlude for math junkies -- Exercises -- Example 5-4: Euclid's Algorithm For GCF -- How it works -- Interlude: Who was Euclid? -- Exercises -- Interlude: Interlude for math junkies: rest of the proof -- Example 5-5: Beautiful Recursion: Tower Of Hanoi -- How it works -- Exercises -- Example 5-6: Random-Number Generator -- How it works -- Exercises -- Games and more games -- Chapter 5 summary -- Arrays: All In A Row: -- First look at C++ Arrays -- Initializing Arrays -- Zero-Based Indexing: -- Interlude: Why use zero-based indexes? -- Example 6-1: Print Out Elements -- How it works -- Exercises -- Example 6-2: How Random Is Random? -- How it works -- Exercises -- Strings And Arrays Of Strings: -- Example 6-3: Print A Number (From Arrays) -- How it works -- Exercises -- Example 6-4: Simple Card Dealer -- How it works -- Exercises -- 2-D Arrays: into the matrix -- Chapter 6 summary -- Pointers: Data By Location: -- What the heck is a pointer, anyway? -- Concept of pointer -- Interlude: What do addresses look like? -- Declaring And Using Pointers: -- Example 7-1: Print Out Address -- Example 7-2: Double_It Function -- How it works -- Exercises -- Data flow in functions -- Swap: Another Function Using Pointers: -- Example 7-3: Array Sorter -- How it works -- Exercises -- Reference Arguments (&) -- Pointer arithmetic -- Pointers And Array Processing: -- Example 7-4: Zero Out An Array -- How it works -- Writing more compact code -- Exercises -- Chapter 7 summary -- Strings: Analyzing The Text: -- Text Storage On The Computer: -- Interlude: How does the computer translate programs? -- It don't mean a thing if it ain't got the String -- String-Manipulation Functions: -- Example 8-1: Building Strings -- How it works -- Exercises -- Interlude: What about escape sequences? -- Reading String Input: -- Example 8-2: Get A Number -- How it works -- Exercise -- Example 8-3: Convert To Uppercase -- How it works -- Exercises -- Individual Characters Versus Strings: -- Example 8-4: Breaking Up Input With Strtok -- How it works -- Exercises -- C++ String Class: -- Include String-Class support -- Declare and initialize variables of Class String -- Working with variables of Class String -- Input and output -- Example 8-5: Building Strings With the String Class -- How it works -- Exercises -- Example 8-6: Adding Machine #2 -- How it works -- Exercises -- Other operations on the String type -- Chapter 8 summary -- Files: Electronic Storage: -- Introducing File: Stream Objects: -- How to refer to disk files -- Example 9-1: Write Text To A File -- How it works -- Exercises -- Example 9-2: Display A Text File -- How it works -- Exercises -- Text Files Versus "Binary" Files: -- Interlude: Are "Binary Files" really more binary? -- Introducing Binary Operations: -- Example 9-3: Random-Access Write -- How it works -- Exercises -- Example 9-4: Random-Access Read -- How it works -- Exercises -- Chapter 9 summary -- Classes And Objects: -- OOP, my code is showing -- What's an object, anyway? -- Interlude: OOP-is it worth it? -- Point: Simple Class: -- Interlude: Interlude for C programmers: structures and Classes -- Private: Members Only (Protecting The Data): -- Example 10-1: Testing The Point Class -- How it works -- Exercises -- Introducing the fraction Class -- Inline functions -- Find the greatest common factor -- Find The Lowest Common Denominator: -- Example 10-2: Fraction Support Functions -- How it works -- Exercises -- Example 10-3: Testing The Fraction Class -- How it works -- Interlude: New kind of #include?: -- Exercises -- Example 10-4: Fraction Arithmetic: Add And Mult -- How it works -- Exercises -- Chapter 10 summary -- Constructors: If You Build It: -- Introducing constructors -- Multiple constructors (overloading) -- C++11/C++14 only: initializing members -- Default Constructor-And A Warning: -- Interlude: Is C++ out to trick you with the default constructor? -- C++11/C++14 Only: Delegating Constructors: -- Example 11-1: Point Class Constructors -- How it works -- Exercises -- Example 11-2: Fraction Class Constructors -- How it works -- Exercises -- Reference variables and arguments (&) -- Copy Constructor: -- Interlude: Copy constructor and references -- Constructor from String to fract -- Chapter 11 summary --
Two Complete OOP Examples:
Other uses of new and delete
Blowin' in the wind: a binary tree app
Example 12-1: Names In Alpha Order
Interlude: Recursion versus iteration compared
Tower Of Hanoi, Animated:
After Mystack Class design
Example 12-2: Animated Tower
Easy Programming With STL:
Introducing The List Template:
Interlude: Writing Template in C++:
Creating and using a list class
Creating and using Iterators
C++11/C++14 only for each
Interlude: Pointers versus Iterators:
Example 13-1: STL Ordered List
Designing AN RPN Calculator:
Interlude: Brief history of polish notation
Introducing the generalized STL Stack Class
Example 13-2: Reverse Polish Calculator
Correct interpretation of Angle Brackets
Object-Oriented Monty Hall:
TV Programming: "Good Deal, Bad Deal":
Example 14-1: Prize-Manager Class
Example 14-2: Door-Manager Class
Example 14-3: Full Monty Program
Monty Hall paradox, or what's behind the door?
Improving the Prize Manager
Doing The Job With Algorithms:
Example 15-1: Primitive Video Poker
Getting Nums From The Player:
How To Evaluate Poker Hands:
Example 15-3: Draw-Poker Payout!
Switching decks at runtime
Polymorphism Is The Answer:
Example 16-1: Virtual Dealer
Interlude: What is the virtual penalty?
Pure virtual and other abstract matters
Abstract Classes and Interfaces
Object Orientation And I/O:
Cout is endlessly extensible
But cout is not polymorphic
Example 16-2: True Polymorphism: The IPrintable Class
Example 17-1: Bitwise Operations
Features introduced in C++11
Interlude: Why a "Natural" Integer?
Working with 64-Bit Literals (constants)
Accepting long long input
Formatting long long numbers
Example 17-2: Fibonacci: 64-Bit Example
Interlude: Who was Fibonacci?
Range-Based "For" (For Each):
Example 17-3: Setting An Array With Range-Based "For"
Auto and decltype keywords
Strongly Typed Enumerations:
Enum Classes in C++11 onward
Extended enum syntax: controlling storage
Operator Functions: Doing It With Class:
Introducing operator Functions
Operator Functions as global Functions
Improve Efficiency With References:
Example 18-1: Point Class Operators
Example 18-2: Fraction Class Operators
Class assignment function (=)
Test-for-equality function (==)
Example 18-3: Completed Fraction Class
Really final word (about Ops)
Old- and new-style type casts
Integer versus floating-point division
Bitwise Operators (&,I,̂,̃,<<,and >>)
Data Types of numeric Literals
String Literals and escape sequences
Two's-complement format for signed Integers
Appendix C: Syntax Summary:
Control Structures And Branch Statements:
Appendix D: Preprocessor Directives:
##Operator (concatenation)
Appendix F: Standard Library Functions:
String (C-string) Functions
Data-conversion Functions
Single-character Functions
Formats for the strftime function
Appendix G: I/O Stream Objects And Classes:
Appendix H: STL Classes And Objects:
Appendix I: Glossary Of Terms