| |
| |
| |
Introduction to Computers and C++ Programming | |
| |
| |
| |
Computer Systems | |
| |
| |
Hardware | |
| |
| |
Software | |
| |
| |
High-Level Languages | |
| |
| |
Compilers | |
| |
| |
History Note | |
| |
| |
| |
Programming and Problem-Solving | |
| |
| |
Algorithms | |
| |
| |
Program Design | |
| |
| |
Object-Oriented Programming | |
| |
| |
The Software Life Cycle | |
| |
| |
| |
Introduction to C++ | |
| |
| |
Origins of the C++ Language | |
| |
| |
A Sample C++ Program | |
| |
| |
Pitfall: Using the Wrong Slash in \n | |
| |
| |
Programming Tip: Input and Output Syntax | |
| |
| |
Layout of a Simple C++ Program | |
| |
| |
Pitfall: Putting a Space before the include File Name | |
| |
| |
Compiling and Running a C++ Program | |
| |
| |
Programming Tip: Getting Your Program to Run | |
| |
| |
| |
Testing and Debugging | |
| |
| |
Kinds of Program Errors | |
| |
| |
Pitfall: Assuming Your Program Is Correct | |
| |
| |
Chapter Summary | |
| |
| |
Answers to Self-Test Exercises | |
| |
| |
Programming Projects | |
| |
| |
| |
C++ Basics | |
| |
| |
| |
Variables and Assignments | |
| |
| |
Variables | |
| |
| |
Names: Identifiers | |
| |
| |
Variable Declarations | |
| |
| |
Assignment Statements | |
| |
| |
Pitfall: Uninitialized Variables | |
| |
| |
Programming Tip: Use Meaningful Names | |
| |
| |
| |
Input and Output 50 Output Using cout | |
| |
| |
Include Directives and Namespaces | |
| |
| |
Escape Sequences | |
| |
| |
Programming Tip: End Each Program with a \n or endl | |
| |
| |
Formatting for Numbers with a Decimal Point | |
| |
| |
Input Using cin | |
| |
| |
Designing Input and Output | |
| |
| |
Programming Tip: Line Breaks in I/O | |
| |
| |
| |
Data types and Expressions | |
| |
| |
The Types int and double | |
| |
| |
Other Number Types | |
| |
| |
The Type char | |
| |
| |
The Type bool | |
| |
| |
Introduction to the Class string | |
| |
| |
Type Compatibilities | |
| |
| |
Arithmetic Operators and Expressions | |
| |
| |
Pitfall: Whole Numbers in Division | |
| |
| |
More Assignment Statements | |
| |
| |
| |
Simple flow of Control | |
| |
| |
A Simple Branching Mechanism | |
| |
| |
Pitfall: Strings of Inequalities | |
| |
| |
Pitfall: Using = in place of == | |
| |
| |
Compound Statements | |
| |
| |
Simple Loop Mechanisms | |
| |
| |
Increment and Decrement Operators | |
| |
| |
Programming Example: Charge Card Balance | |
| |
| |
Pitfall: Infinite Loops | |
| |
| |
| |
Program Style | |
| |
| |
Indenting | |
| |
| |
Comments | |
| |
| |
Naming Constants | |
| |
| |
Chapter Summary | |
| |
| |
Answers to Self-Test Exercises | |
| |
| |
Programming Projects | |
| |
| |
| |
More Flow of Control | |
| |
| |
| |
Using Boolean Expressions | |
| |
| |
Evaluating Boolean Expressions | |
| |
| |
Pitfall: Boolean Expressions Convert to int Values | |
| |
| |
Enumeration Types (Optional) | |
| |
| |
| |
Multiway Branches | |
| |
| |
Nested Statements | |
| |
| |
Programming Tip: Use Braces in Nested Statements | |
| |
| |
Multiway if-else Statements | |
| |
| |
Programming Example: State Income Tax | |
| |
| |
The switch Statement | |
| |
| |
Pitfall: Forgetting a break in a switch Statement | |
| |
| |
Using switch Statements for Menus | |
| |
| |
Blocks | |
| |
| |
Pitfall: Inadvertent Local Variables | |
| |
| |
| |
More About C++ Loop Statements | |
| |
| |
The while Statements Reviewed | |
| |
| |
Increment and Decrement Operators Revisited | |
| |
| |
The for Statement | |
| |
| |
Pitfall: Extra Semicolon in a for Statement | |
| |
| |
What Kind of Loop to Use | |
| |
| |
Pitfall: Uninitialized Variables and Infinite Loops | |
| |
| |
The break Statement | |
| |
| |
Pitfall: The break Statement in Nested Loops | |
| |
| |
| |
Designing Loops | |
| |
| |
Loops for Sums and Products | |
| |
| |
Ending a Loop | |
| |
| |
Nested Loops | |
| |
| |
Debugging L | |