| |
| |
Preface | |
| |
| |
| |
Introduction to Computers and Programming | |
| |
| |
| |
Why Program? | |
| |
| |
| |
Computer Systems: Hardware and Software | |
| |
| |
| |
Programs and Programming Languages | |
| |
| |
| |
What is a Program Made of? | |
| |
| |
| |
Input, Processing, and Output | |
| |
| |
| |
the Programming Process | |
| |
| |
| |
Procedural and Object-Oriented Programming | |
| |
| |
| |
Introduction to C++ | |
| |
| |
| |
the Parts of a C++ Program | |
| |
| |
| |
the cout Object | |
| |
| |
| |
the #include Directive | |
| |
| |
| |
Variables and Literals | |
| |
| |
| |
Identifiers | |
| |
| |
| |
Integer Data Types | |
| |
| |
| |
the char Data Type | |
| |
| |
| |
the C++ string Class | |
| |
| |
| |
Floating-Point Data Types | |
| |
| |
| |
the bool Data Type | |
| |
| |
| |
Determining the Size of a Data Type | |
| |
| |
| |
Variable Assignments and Initialization | |
| |
| |
| |
Scope | |
| |
| |
| |
Arithmetic Operators | |
| |
| |
| |
Comments | |
| |
| |
| |
Named Constants | |
| |
| |
| |
Programming Style | |
| |
| |
| |
If You Plan to Continue in Computer Science: Standard and Prestandard C++ | |
| |
| |
| |
Expressions and Interactivity | |
| |
| |
| |
the cin Object | |
| |
| |
| |
Mathematical Expressions | |
| |
| |
| |
When You Mix Apples and Oranges: Type Conversion | |
| |
| |
| |
Overflow and Underflow | |
| |
| |
| |
Type Casting | |
| |
| |
| |
Multiple Assignment and Combined Assignment | |
| |
| |
| |
Formatting Output | |
| |
| |
| |
Working with Characters and string Objects | |
| |
| |
| |
More Mathematical Library Functions | |
| |
| |
| |
Focus on Debugging: Hand Tracing a Program | |
| |
| |
| |
Focus on Problem Solving: A Case Study | |
| |
| |
| |
Making Decisions | |
| |
| |
| |
Relational Operators | |
| |
| |
| |
the if Statement | |
| |
| |
| |
Expanding the if Statement | |
| |
| |
| |
the if/else Statement | |
| |
| |
| |
Nested if Statements | |
| |
| |
| |
the if/else if Statement | |
| |
| |
| |
Flags | |
| |
| |
| |
Logical Operators | |
| |
| |
| |
Checking Numeric Ranges with Logical Operators | |
| |
| |
| |
Menus | |
| |
| |
| |
Focus on Software Engineering: Validating User Input | |
| |
| |
| |
Comparing Characters and Strings | |
| |
| |
| |
the Conditional Operator | |
| |
| |
| |
the switch Statement | |
| |
| |
| |
More About Blocks and Scope | |
| |
| |
| |
Loops and Files | |
| |
| |
| |
the Increment and Decrement Operators | |
| |
| |
| |
Introduction to Loops: the while Loop | |
| |
| |
| |
Using the while Loop for Input Validation | |
| |
| |
| |
Counters | |
| |
| |
| |
the do-while Loop | |
| |
| |
| |
the for Loop | |
| |
| |
| |
Keeping a Running Total | |
| |
| |
| |
Sentinels | |
| |
| |
| |
Focus on Software Engineering: Deciding Which Loop to Use | |
| |
| |
| |
Nested Loops | |
| |
| |
| |
Using Files for Data Storage | |
| |
| |
| |
Optional Topics: Breaking and Continuing a Loop | |
| |
| |
| |
Functions | |
| |
| |
| |
Focus on Software Engineering: Modular Programming | |
| |
| |
| |
Defining and Calling Functions | |
| |
| |
| |
Function Prototypes | |
| |
| |
| |
Sending Data into a Function | |
| |
| |
| |
Passing Data by Value | |
| |
| |
| |
Focus on Software Engineering: Using Functions in a Menu-Driven Program | |
| |
| |
| |
the return Statement | |
| |
| |
| |
Returning a Value from a Function | |
| |
| |
| |
Returning a Boolean Value | |
| |
| |
| |
Local and Global Variables | |
| |
| |
| |
Static Local Variables | |
| |
| |
| |
Default Arguments | |
| |
| |
| |
Using Reference Variables as Parameters | |
| |
| |
| |
Overloading Functions | |
| |
| |
| |
the exit() Function | |
| |
| |
| |
Stubs and Drivers | |
| |
| |
| |
Arrays | |
| |
| |
| |
Arrays Hold Multiple Values | |
| |
| |
| |
Accessing Array Elements | |
| |
| |
| |
No Bounds Checking in C++ | |
| |
| |
| |
Array Initialization | |
| |
| |
| |
Processing Array Contents | |
| |
| |
| |
Focus on Software Engineering: Using Parallel Arrays | |
| |
| |
| |
Arrays as Function Arguments | |
| |
| |
| |
Two-Dimensional Arrays | |
| |
| |
| |
Arrays with Three or More Dimensions | |
| |
| |
| |
Focus on Problem Solving and Program Design: A Case Study | |
| |
| |
| |
If You Plan to Continue in Computer Science: Introduction to the STL vector | |
| |
| |
| |
Searching and Sorting Arrays | |
| |
| |
| |
Focus on Software Engineering: Introduction to Search Algorithms | |
| |
| |
| |
Focus on Problem Solving and Program Design: A Case Study | |
| |
| |
| |
Focus on Software Engineering: Introduction to Sorting Algorithms | |
| |
| |
| |
Focus on Problem Solving and Program Design: A Case Study | |
| |
| |
| |
If You Plan to Continue in Computer Science: Sorting and Searching vectors | |
| |
| |
| |
Pointers | |
| |
| |
| |
Getting the Address of a Variable | |
| |
| |
| |
Pointer Variables | |
| |
| |
| |
the Relationship Between Arrays and Pointers | |
| |
| |
| |
Pointer Arithmetic | |
| |
| |
| |
Initializing Pointers | |
| |
| |
| |
Comparing Pointers | |
| |
| |
| |
Pointers as Function Parameters | |
| |
| |
| |
Focus on Software Engineering: Dynamic Memory Allocation | |
| |
| |
| |
Focus on Software Engineering: Returning Pointers from Functions | |
| |
| |
| |
Focus on Problem Solving and Program Design: A Case Study | |
| |
| |
| |
Characters, C-Strings, and More About the string Class | |
| |
| |
| |
Character Testing | |
| |
| |
| |
Character Case Conversion | |
| |
| |
| |
C-Strings | |
| |
| |
| |
Library Functions for Working with C-Strings | |
| |
| |
| |
C-String/Numeric Conversion Functions | |
| |
| |
| |
Focus on Software Engineering: Writing Your Own C-String-Handling Functions | |
| |
| |
| |
More About the C++ string Class | |
| |
| |
| |
Focus on Problem Solving and Program Design: A Case Study | |
| |
| |
| |
Structured Data | |
| |
| |
| |
Abstract Data Types | |
| |
| |
| |
Focus on Software Engineering: Combining Data into Structures | |
| |
| |
| |
Accessing Structure Members | |
| |
| |
| |
Initializing a Structure | |
| |
| |
| |
Arrays of Structures | |
| |
| |
| |
Focus on Software Engineering: Nested Structures | |
| |
| |
| |
Structures as Function Arguments | |
| |
| |
| |
Returning a Structure from a Function | |
| |
| |
| |
Pointers to Structures | |
| |
| |
| |
Focus on Software Engineering: When to Use., When to Use ->, and When to Use | |
| |
| |
| |
Unions | |
| |
| |
| |
Enumerated Data Types | |
| |
| |
| |
Advanced File Operations | |
| |
| |
| |
File Operations | |
| |
| |
| |
File Output Formatting | |
| |
| |
| |
Passing File Stream Objects to Functions | |
| |
| |
| |
More Detailed Error Testing | |
| |
| |
| |
Member Functions for Reading and Writing Files | |
| |
| |
| |
Focus on Software Engineering: Working with Multiple Files | |
| |
| |
| |
Binary Files | |
| |
| |
| |
Creating Records with Structures | |
| |
| |
| |
Random-Access Files | |
| |
| |
| |
Opening a File for Both Input and Output | |
| |
| |
| |
Introduction to Classes | |
| |
| |
| |
Procedural and Object-Oriented Programming | |
| |
| |
| |
Introduction to Classes | |
| |
| |
| |
Defining an Instance of a Class | |
| |
| |
| |
Why Have Private Members? | |
| |
| |
| |
Focus on Software Engineering: Separating Class Specification from Implementation | |
| |
| |
| |
Inline Member Functions | |
| |
| |
| |
Constructors | |
| |
| |
| |
Passing Arguments to Constructors | |
| |
| |
| |
Destructors | |
| |
| |
| |
Overloading Constructors | |
| |
| |
| |
Private Member Functions | |
| |
| |
| |
Arrays of Objects | |
| |
| |
| |
Focus on Problem Solving and Program Design: An OOP Case Study | |
| |
| |
| |
Focus on Object-Oriented Programming: Creating an Abstract Array Data Type | |
| |
| |
| |
Focus on Object-Oriented Design: the Unified Modeling Language (UML) | |
| |
| |
| |
Focus on Object-Oriented Design: Finding the Classes and Their Responsibilities | |
| |
| |
| |
More About Classes | |
| |
| |
| |
Instance and Static Members | |
| |
| |
| |
Friends of Classes | |
| |
| |
| |
Memberwise Assignment | |
| |
| |
| |
Copy Constructors | |
| |
| |
| |
Operator Overloading | |
| |
| |
| |
Object Conversion | |
| |
| |
| |
Aggregation | |
| |
| |
| |
Focus on Object-Oriented Design: Class Collaborations | |
| |
| |
| |
Inheritance, Polymorphism, and Virtual Functions | |
| |
| |
| |
What Is Inheritance? | |
| |
| |
| |
Protected Members and Class Access | |
| |
| |
| |
Constructors and Destructors in Base and Derived Classes | |
| |
| |
| |
Redefining Base Class Functions | |
| |
| |
| |
Class Hierarchies | |
| |
| |
| |
Polymorphism and Virtual Member Functions | |
| |
| |
| |
Abstract Base Classes and Pure Virtual Functions | |
| |
| |
| |
Multiple Inheritance | |
| |
| |
| |
Getting Started with Alice | |
| |
| |
| |
the ASCII Character Set | |
| |
| |
| |
Operator Precedence and Associativity | |
| |
| |
Quick References | |
| |
| |
Index | |
| |
| |
Online: the following appendices are available at www.pearsonhighered.com/gaddis | |
| |
| |
| |
Introduction to Flowcharting | |
| |
| |
| |
Using UML in Class Design | |
| |
| |
| |
Namespaces | |
| |
| |
| |
Writing Managed C++ Code for the .NET Framework | |
| |
| |
| |
Passing Command Line Arguments | |
| |
| |
| |
Header File and Library Function Reference | |
| |
| |
| |
Binary Numbers and Bitwise Operations | |
| |
| |
| |
Multi-Source File Programs | |
| |
| |
| |
Stream Member Functions for Formatting | |
| |
| |
| |
Introduction to Microsoft Visual C++ 2010 Express Edition | |
| |
| |
| |
Answers to Checkpoints | |
| |
| |
| |
Solutions to Odd-Numbered Review Questions | |