Table of Contents:
Preface.
Why a New C++ Book?
What Else Is New about This Book?
Multiple Learning Paths:What Fits You Best.
What If You Already Have a Programming Background?
What Is Not Covered?
Why Should Anyone Start with C++?
To Get Started.
Tips and Tricks: What Do I Watch Out For?
Acknowledgments.
1. Your First C++ Programs.
Thinking like a Programmer.
What's Different about C++?
Building a C++ Program.
Installing Your Own C++ Compiler.
Example 1.1. Print a Message.
Advancing to the Next Print Line.
Example 1.2. Print Multiple Lines.
Storing Data: C++ Variables.
Introduction to Data Types.
Example 1.3. Convert Temperatures.
A Word about Variable Names and Keywords.
Chapter 1 Summary.
2. Decisions, Decisions.
But First, a Few Words about Data Types.
Decision Making in Programs.
If and if-else.
Example 2.1. Odd or Even?
Introducing Loops.
Example 2.2. Print 1 to N.
True and False in C++.
The Increment Operator (++).
Statements vs. Expressions.
Introducing Boolean (Short-Circuit) Logic.
Example 2.3. Testing a Person's Age.
Introducing the Math Library.
Example 2.4. Prime-Number Test.
Chapter 2 Summary.
3. The Handy, All-Purpose "for" Statement.
Loops Used for Counting.
Introducing the "for" Loop.
A Wealth of Examples.
Example 3.1. Printing 1 to N with "for".
Statement Blocks with "for".
Declaring Loop Variables on the Fly.
Example 3.2. Prime-Number Test with "for".
Comparative Languages 101: The Basic "for" Statement.
Chapter 3 Summary.
4. Functions: Many Are Called.
The Concept of Function.
Function Calls and the Flow of the Program.
The Basics of Using Functions.
Example 4.1. Triangle-Number Function.
Example 4.2. Prime-Number Function.
Local and Global Variables.
Recursive Functions.