| |
| |
Introduction | |
| |
| |
Who Should Read This Book | |
| |
| |
Conventions Used in This Book | |
| |
| |
Sample Code for This Book | |
| |
| |
Week 1 At a Glance | |
| |
| |
A Note to C Programmers | |
| |
| |
Where You Are Going | |
| |
| |
| |
Getting Started | |
| |
| |
A Brief History of C++ | |
| |
| |
The Need for Solving Problems | |
| |
| |
Procedural, Structured, and Object-Oriented Programming | |
| |
| |
Object-Oriented Programming (OOP) | |
| |
| |
C++ and Object-Oriented Programming | |
| |
| |
How C++ Evolved | |
| |
| |
Should I Learn C First? | |
| |
| |
C++, Java, and C# | |
| |
| |
Microsoft's Managed Extensions to C++ | |
| |
| |
The ANSI Standard | |
| |
| |
Preparing to Program | |
| |
| |
Your Development Environment | |
| |
| |
The Process of Creating the Program | |
| |
| |
Creating an Object File with the Compiler | |
| |
| |
Creating an Executable File with the Linker | |
| |
| |
The Development Cycle | |
| |
| |
HELLO.cpp-Your First C++ Program | |
| |
| |
Getting Started with Your Compiler | |
| |
| |
Building the Hello World Project | |
| |
| |
Compile Errors | |
| |
| |
Summary | |
| |
| |
Q &A | |
| |
| |
Workshop | |
| |
| |
Quiz | |
| |
| |
Exercises | |
| |
| |
| |
The Anatomy of a C++ Program | |
| |
| |
A Simple Program | |
| |
| |
A Brief Look at cout | |
| |
| |
Using the Standard Namespace | |
| |
| |
Commenting Your Programs | |
| |
| |
Types of Comments | |
| |
| |
Using Comments | |
| |
| |
A Final Word of Caution About Comments | |
| |
| |
Functions | |
| |
| |
Using Functions | |
| |
| |
Methods Versus Functions | |
| |
| |
Summary | |
| |
| |
Q &A | |
| |
| |
Workshop | |
| |
| |
Quiz | |
| |
| |
Exercises | |
| |
| |
| |
Working with Variables and Constants | |
| |
| |
What Is a Variable? | |
| |
| |
Storing Data in Memory | |
| |
| |
Setting Aside Memory | |
| |
| |
Size of Integers | |
| |
| |
signed and unsigned | |
| |
| |
Fundamental Variable Types | |
| |
| |
Defining a Variable | |
| |
| |
Case Sensitivity | |
| |
| |
Naming Conventions | |
| |
| |
Keywords | |
| |
| |
Creating More Than One Variable at a Time | |
| |
| |
Assigning Values to Your Variables | |
| |
| |
Creating Aliases with typedef | |
| |
| |
When to Use short and When to Use long | |
| |
| |
Wrapping Around an unsigned Integer | |
| |
| |
Wrapping Around a signed Integer | |
| |
| |
Working with Characters | |
| |
| |
Characters and Numbers | |
| |
| |
Special Printing Characters | |
| |
| |
Constants | |
| |
| |
Literal Constants | |
| |
| |
Symbolic Constants | |
| |
| |
Enumerated Constants | |
| |
| |
Summary | |
| |
| |
Q &A | |
| |
| |
Workshop | |
| |
| |
Quiz | |
| |
| |
Exercises | |
| |
| |
| |
Creating Expressions and Statements | |
| |
| |
Starting with Statements | |
| |
| |
Using Whitespace | |
| |
| |
Blocks and Compound Statements | |
| |
| |
Expressions | |
| |
| |
Working with Operators | |
| |
| |
Assignment Operators | |
| |
| |
Mathematical Operators | |
| |
| |
Combining the Assignment and Mathematical Operators | |
| |
| |
Incrementing and Decrementing | |
| |
| |
Prefixing Versus Postfixing | |
| |
| |
Understanding Operator Precedence | |
| |
| |
Nesting Parentheses | |
| |
| |
The Nature of Truth | |
| |
| |
Evaluating with the Relational Operators | |
| |
| |
The if Statement | |
| |
| |
Indentation Styles | |
| |
| |
The else Statement | |
| |
| |
Advanced if Statements | |
| |
| |
Using Braces in Nested if Statements | |
| |
| |
Using the Logical Operators | |
| |
| |
The Logical AND Operator | |
| |
| |
The Logical OR Operator | |
| |
| |
The Logical NOT Operator | |
| |
| |
Short Circuit Evaluation | |
| |
| |
Relational Precedence | |
| |
| |
More About Truth and Falsehood | |
| |
| |
The Conditional (Ternary) Operator | |
| |
| |
Summary | |
| |
| |
Q &A | |
| |
| |
Workshop | |
| |
| |
Quiz | |
| |
| |
Exercises | |
| |
| |
| |
Organizing into Functions | |
| |
| |
What Is a Function? | |
| |
| |
Return Values, Parameters, and Arguments | |
| |
| |
Declaring and Defining Functions | |
| |
| |
Function Prototypes | |
| |
| |
Defining the Function | |
| |
| |
Execution of Functions | |
| |
| |
Determining Variable Scope | |
| |
| |
Local Variables | |
| |
| |
Local Variables Within Blocks | |
| |
| |
Parameters Are Local Variables | |
| |
| |
Global Variables | |
| |
| |
Global Variabl | |