| |
| |
Preface | |
| |
| |
| |
An Overview of Computers and Programming Languages | |
| |
| |
Introduction | |
| |
| |
A Brief Overview of the History of Computers | |
| |
| |
Elements of a Computer System | |
| |
| |
Hardware | |
| |
| |
Central Processing Unit | |
| |
| |
Main Memory | |
| |
| |
Secondary Storage | |
| |
| |
Input/Output Devices | |
| |
| |
Software | |
| |
| |
The Language of a Computer | |
| |
| |
The Evolution of Programming Languages | |
| |
| |
A C++ Program | |
| |
| |
Processing a C++ Program | |
| |
| |
Programming with the Problem Analysis-Coding-Execution Cycle | |
| |
| |
Programming Methodologies | |
| |
| |
Structured Programming | |
| |
| |
Object-Oriented Programming | |
| |
| |
ANSI/ISO Standard C++ | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
| |
Basic Elements of C++ | |
| |
| |
The Basics of a C++ Program | |
| |
| |
Special Symbols | |
| |
| |
Word Symbols | |
| |
| |
Identifiers | |
| |
| |
Data Types | |
| |
| |
Simple Data Types | |
| |
| |
Floating-Point Data Types | |
| |
| |
Arithmetic Operators and Operator Precedence | |
| |
| |
Order of Precedence | |
| |
| |
Expressions | |
| |
| |
Mixed Expressions | |
| |
| |
Type Conversion (Casting) | |
| |
| |
string Type | |
| |
| |
Input | |
| |
| |
Allocating Memory with Constants and Variables | |
| |
| |
Putting Data into Variables | |
| |
| |
Assignment Statement | |
| |
| |
Saving and Using the Value of an Expression | |
| |
| |
Declaring and Initializing Variables | |
| |
| |
Input (Read) Statement | |
| |
| |
Variable Initialization | |
| |
| |
Increment and Decrement Operators | |
| |
| |
Output | |
| |
| |
Preprocessor Directives | |
| |
| |
namespace and Using cin and cout in a Program | |
| |
| |
Using the string Data Type in a Program | |
| |
| |
Creating a C++ Program | |
| |
| |
Program Style and Form | |
| |
| |
Syntax | |
| |
| |
Use of Blanks | |
| |
| |
Use of Semicolons, Brackets, and Commas | |
| |
| |
Semantics | |
| |
| |
Naming Identifiers | |
| |
| |
Prompt Lines | |
| |
| |
Documentation | |
| |
| |
Comments | |
| |
| |
Form and Style | |
| |
| |
More on Assignment Statements | |
| |
| |
Programming Example: Convert Length | |
| |
| |
Programming Example: Make Change | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Intput/Output | |
| |
| |
I/O Streams and Standard I/O Devices | |
| |
| |
cin and the Extraction Operator [double greater-than sign] | |
| |
| |
Using Predefined Functions in a Program | |
| |
| |
cin and the get Function | |
| |
| |
cin and the ignore Function | |
| |
| |
The putback and peek Functions | |
| |
| |
The Dot Notation Between I/O Stream Variables and I/O Functions: A Precaution | |
| |
| |
Input Failure | |
| |
| |
The clear Function | |
| |
| |
Output and Formatting Output | |
| |
| |
setprecision Manipulator | |
| |
| |
fixed Manipulator | |
| |
| |
showpoint Manipulator | |
| |
| |
setw | |
| |
| |
flush Manipulator | |
| |
| |
Additional Output Formatting Tools | |
| |
| |
setfill Manipulator | |
| |
| |
left and right Manipulators | |
| |
| |
Input/Output and the string Type | |
| |
| |
File Input/Output | |
| |
| |
Programming Example: Movie Ticket Sale and Donation to Charity | |
| |
| |
Programming Example: Student Grade | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Control Structures I (Selection) | |
| |
| |
Control Structures | |
| |
| |
Relational Operators | |
| |
| |
Relational Operators and Simple Data Types | |
| |
| |
Relational Operators and the string Type | |
| |
| |
Logical (Boolean) Operators and Logical Expressions | |
| |
| |
Order of Precedence | |
| |
| |
Short-Circuit Evaluation | |
| |
| |
int Data Type and Logical (Boolean) Expressions | |
| |
| |
bool Data Type and Logical (Boolean) Expressions | |
| |
| |
Selection: if and if...else | |
| |
| |
One-Way Selection | |
| |
| |
Two-Way Selection | |
| |
| |
Compound (Block of) Statements | |
| |
| |
Multiple Selections: Nested if | |
| |
| |
Comparing if...else Statements with a Series of if Statements | |
| |
| |
Using Pseudocode to Develop, Test, and Debug a Program | |
| |
| |
Input Failure and the if Statement | |
| |
| |
Confusion Between the Equality Operator (==) and the Assignment Operator (=) | |
| |
| |
Conditional Operator (? :) | |
| |
| |
switch Structures | |
| |
| |
Terminating a Program with the assert Function | |
| |
| |
Programming Example: Cable Company Billing | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Control Structures II (Repetition) | |
| |
| |
Why Is Repetition Needed? | |
| |
| |
shile Looping (Repetition) Structure | |
| |
| |
| |
Counter-Controlled while Loops | |
| |
| |
| |
Sentinel-Controlled while Loops | |
| |
| |
| |
Flag-Controlled while Loops | |
| |
| |
| |
EOF-Controlled while Loops | |
| |
| |
Eof Function | |
| |
| |
More on Expressions in while Statements | |
| |
| |
Programming Example: Checking Account Balance | |
| |
| |
Programming Example: Fibonacci Number | |
| |
| |
For Looping (Repetition) Structure | |
| |
| |
Programming Example: Classifying Numbers | |
| |
| |
Do...while Looping (Repetition) Structure | |
| |
| |
Break and continue Statements | |
| |
| |
Nested Control Structures | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
User-Defined Functions I | |
| |
| |
Predefined Functions | |
| |
| |
User-Defined Functions | |
| |
| |
Value-Returning Functions | |
| |
| |
Syntax: Value-Returning function | |
| |
| |
Syntax: Formal Parameter List | |
| |
| |
Function Call | |
| |
| |
Syntax: Actual Parameter List | |
| |
| |
Return Statement | |
| |
| |
Syntax: return Statement | |
| |
| |
Function Prototype | |
| |
| |
Syntax: Function Prototype | |
| |
| |
Flow of Execution | |
| |
| |
Programming Example: Largest Number | |
| |
| |
Programming Example: Cable Company | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
User-Defined Functions II | |
| |
| |
Void Functions | |
| |
| |
Void Functions Without Parameters | |
| |
| |
Void Functions with Parameters | |
| |
| |
Value Parameters | |
| |
| |
Reference Variables as Parameters | |
| |
| |
Value and Reference Parameters and Memory Allocation | |
| |
| |
Reference Parameters and Value-Returning Functions | |
| |
| |
Scope of an Identifier | |
| |
| |
Global Variables, Named Constants, and Side Effects | |
| |
| |
Static and Automatic Variables | |
| |
| |
Function Overloading: An Introduction | |
| |
| |
Functions with Default Parameters | |
| |
| |
Programming Example: Classify Numbers | |
| |
| |
Programming Example: Data Comparison | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
User-Defined Simple Data Types, Namespaces, and the string Type | |
| |
| |
Enumeration Type | |
| |
| |
Declaring Variables | |
| |
| |
Assignment | |
| |
| |
Operations on Enumeration Types | |
| |
| |
Relational Operators | |
| |
| |
Input/Output of Enumeration Types | |
| |
| |
Functions and Enumeration Types | |
| |
| |
Declaring Variables When Defining the Enumeration Type | |
| |
| |
Anonymous Data Types | |
| |
| |
typedef Statement | |
| |
| |
Programming Example: The Game of Rock, Paper, and Scissors | |
| |
| |
Namespaces | |
| |
| |
string Type | |
| |
| |
Additional string Operations | |
| |
| |
length Function | |
| |
| |
size Function | |
| |
| |
find Function | |
| |
| |
substr Function | |
| |
| |
swap Function | |
| |
| |
Programming Example: Pig Latin Strings | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Arrays and Strings | |
| |
| |
Arrays | |
| |
| |
Accessing Array Components | |
| |
| |
Processing One-Dimensional Arrays | |
| |
| |
Array Index Out of Bounds | |
| |
| |
Array Initialization During Declaration | |
| |
| |
Partial Initialization of Arrays During Declaration | |
| |
| |
Some Restrictions on Array Processing | |
| |
| |
Arrays as Parameters to Functions | |
| |
| |
Constant Arrays as Formal Parameters | |
| |
| |
Base Address of an Array and Array in Computer Memory | |
| |
| |
Functions Cannot Return a Value of the Type array | |
| |
| |
Integral Data Type and Array Indices | |
| |
| |
Other Ways to Declare Arrays | |
| |
| |
C-strings (Character Arrays) | |
| |
| |
String Comparison | |
| |
| |
Reading and Writing Strings | |
| |
| |
String Input | |
| |
| |
String Output | |
| |
| |
Specifying Input/Output Files at Execution Time | |
| |
| |
string Type and Input/Output Files | |
| |
| |
Parallel Arrays | |
| |
| |
Two- and Multidimensional Arrays | |
| |
| |
Accessing Array Components | |
| |
| |
Two-Dimensional Array Initialization During Declaration | |
| |
| |
Two-Dimensional Arrays and Enumeration Types | |
| |
| |
Initialization | |
| |
| |
Print | |
| |
| |
Input | |
| |
| |
Sum by Row | |
| |
| |
Sum by Column | |
| |
| |
Largest Element in Each Row and Each Column | |
| |
| |
Reversing Diagonal | |
| |
| |
Passing Two-Dimensional Arrays as Parameters to Functions | |
| |
| |
Arrays of Strings | |
| |
| |
Arrays of Strings and the string Type | |
| |
| |
Arrays of Strings and C-Strings (Character Arrays) | |
| |
| |
Another Way to Declare a Two-Dimensional Array | |
| |
| |
Multidimensional Arrays | |
| |
| |
Programming Example: Code Detection | |
| |
| |
Programming Example: Text Processing | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Records (structS) | |
| |
| |
Records (structS) | |
| |
| |
Accessing struct Members | |
| |
| |
Assignment | |
| |
| |
Comparison (Relational Operators) | |
| |
| |
Input/Output | |
| |
| |
struct Variables and Functions | |
| |
| |
Arrays versus structS | |
| |
| |
ArrayS in structs | |
| |
| |
structS in Arrays | |
| |
| |
structS within a struct | |
| |
| |
Programming Example: Sales Data Analysis | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Classes and Data Abstraction | |
| |
| |
Classes | |
| |
| |
Unified Modeling Language Class Diagrams | |
| |
| |
Variable (Object) Declaration | |
| |
| |
Accessing Class Members | |
| |
| |
Built-in Operations on Classes | |
| |
| |
Assignment Operator and Classes | |
| |
| |
Class Scope | |
| |
| |
Functions and Classes | |
| |
| |
Reference Parameters and Class Objects (Variables) | |
| |
| |
Implementation of Member Functions | |
| |
| |
Accessor and Mutator Functions | |
| |
| |
Order of public and private Members of a Class | |
| |
| |
Constructors | |
| |
| |
Invoking a Constructor | |
| |
| |
Invoking the Default Constructor | |
| |
| |
Invoking a Constructor with Parameters | |
| |
| |
Constructors and Default Parameters | |
| |
| |
Classes and Constructors: A Precaution | |
| |
| |
Arrays of Class Objects (Variables) and Constructors | |
| |
| |
Destructors | |
| |
| |
Data Abstraction, Classes, and Abstract Data Types | |
| |
| |
A struct Versus a class | |
| |
| |
Information Hiding | |
| |
| |
Executable Code | |
| |
| |
Static Members of a Class | |
| |
| |
Programming Example: Candy Machine | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Inheritance and Composition | |
| |
| |
Inheritance | |
| |
| |
Redefining (Overriding) Member Functions of the Base Class | |
| |
| |
Constructors of Derived and Base Classes | |
| |
| |
Multiple Inclusions of a Header File | |
| |
| |
C++ Stream Classes | |
| |
| |
Protected Members of a Class | |
| |
| |
Inheritance as public, protected, or private | |
| |
| |
Composition | |
| |
| |
Object-Oriented Design (OOD) and Object-Oriented Programming (OOP) | |
| |
| |
Identifying Classes, Objects, and Operations | |
| |
| |
Programming Example: Grade Report | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Pointers, Classes, Virtual Functions, Abstract Classes, and Lists | |
| |
| |
Pointer Data Type and Pointer Variables | |
| |
| |
Declaring Pointer Variables | |
| |
| |
Address of Operator (&) | |
| |
| |
Dereferencing Operator (*) | |
| |
| |
Classes, Structs, and Pointer Variables | |
| |
| |
Initializing Pointer Variables | |
| |
| |
Dynamic Variables | |
| |
| |
Operator new | |
| |
| |
Operator delete | |
| |
| |
Operations on Pointer Variables | |
| |
| |
Dynamic Arrays | |
| |
| |
Functions and Pointers | |
| |
| |
Pointers and Function Return Values | |
| |
| |
Dynamic Two-Dimensional Arrays | |
| |
| |
Shallow versus Deep Copy and Pointers | |
| |
| |
Classes and Pointers: Some Peculiarities | |
| |
| |
Destructor | |
| |
| |
Assignment Operator | |
| |
| |
Copy Constructor | |
| |
| |
Inheritance, Pointers, and Virtual Functions | |
| |
| |
Classes and Virtual Destructors | |
| |
| |
Abstract Classes and Pure Virtual Functions | |
| |
| |
Array-Based Lists | |
| |
| |
Unordered Lists | |
| |
| |
Ordered Lists | |
| |
| |
Address of Operator and Classes | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Overloading and Templates | |
| |
| |
Why Operator Overloading Is Needed | |
| |
| |
Operator Overloading | |
| |
| |
Syntax for Operator Functions | |
| |
| |
Overloading an Operator: Some Restrictions | |
| |
| |
Pointer this | |
| |
| |
Friend Functions of Classes | |
| |
| |
Operator Functions as Member Functions and Nonmember Functions | |
| |
| |
Overloading Binary Operators | |
| |
| |
Overloading the Stream Insertion ([double less-than sign]) and Extraction ([double greater-than sign]) Operators | |
| |
| |
Overloading the Assignment Operator (=) | |
| |
| |
Overloading Unary Operators | |
| |
| |
Operator Overloading: Member versus Nonmember | |
| |
| |
Classes and Pointer Member Variables (Revisited) | |
| |
| |
Operator Overloading: One Final Word | |
| |
| |
Programming Example: clockType | |
| |
| |
Programming Example: Complex Numbers | |
| |
| |
Overloading the Array Index (Subscript) Operator ([]) | |
| |
| |
Programming Example: newString | |
| |
| |
Function Overloading | |
| |
| |
Templates | |
| |
| |
Function Templates | |
| |
| |
Class Templates | |
| |
| |
Array-Based Lists (Revisited) | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Exception Handling | |
| |
| |
Handling Exceptions within a Program | |
| |
| |
C++ Mechanisms of Exception Handling | |
| |
| |
try/catch Block | |
| |
| |
Using C++ Exception Classes | |
| |
| |
Creating Your Own Exception Classes | |
| |
| |
Rethrowing and Throwing an Exception | |
| |
| |
Exception Handling Techniques | |
| |
| |
Terminate the Program | |
| |
| |
Fix the Error and Continue | |
| |
| |
Log the Error and Continue | |
| |
| |
Stack Unwinding | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Recursion | |
| |
| |
Recursive Definitions | |
| |
| |
Direct and Indirect Recursion | |
| |
| |
Infinite Recursion | |
| |
| |
Problem Solving Using Recursion | |
| |
| |
Tower of Hanoi: Analysis | |
| |
| |
Recursion or Iteration? | |
| |
| |
Programming Example: Converting a Number from Binary to Decimal | |
| |
| |
Programming Example: Converting a Number from Decimal to Binary | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Linked Lists | |
| |
| |
Linked Lists | |
| |
| |
Linked Lists: Some Properties | |
| |
| |
Building a Linked List | |
| |
| |
Linked List as an ADT | |
| |
| |
Structure of Linked List Nodes | |
| |
| |
Member Variables of the class linkedListType | |
| |
| |
Linked List Iterators | |
| |
| |
Print the List | |
| |
| |
Length of a List | |
| |
| |
Retrieve the Data of the First Node | |
| |
| |
Retrieve the Data of the Last Node | |
| |
| |
Begin and End | |
| |
| |
Copy the List | |
| |
| |
Destructor | |
| |
| |
Copy Constructor | |
| |
| |
Overloading the Assignment Operator | |
| |
| |
Unordered Linked Lists | |
| |
| |
Search the List | |
| |
| |
Insert the First Node | |
| |
| |
Insert the Last Node | |
| |
| |
Header File of the Unordered Linked List | |
| |
| |
Ordered Linked Lists | |
| |
| |
Search the List | |
| |
| |
Insert a Node | |
| |
| |
Insert First and Insert Last | |
| |
| |
Delete a Node | |
| |
| |
Header File of the Ordered Linked List | |
| |
| |
Print a Linked List in Reverse Order (Recursion Revisited) | |
| |
| |
printListReverse | |
| |
| |
Doubly Linked Lists | |
| |
| |
Default Constructor | |
| |
| |
isEmptyList | |
| |
| |
Destroy the List | |
| |
| |
Initialize the List | |
| |
| |
Length of the List | |
| |
| |
Print the List | |
| |
| |
Reverse Print the List | |
| |
| |
Search the List | |
| |
| |
First and Last Elements | |
| |
| |
Circular Linked Lists | |
| |
| |
Programming Example: Video Store | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Stacks and Queues | |
| |
| |
Stacks | |
| |
| |
Stack Operations | |
| |
| |
Implementation of Stacks as Arrays | |
| |
| |
Initialize Stack | |
| |
| |
Empty Stack | |
| |
| |
Full Stack | |
| |
| |
Push | |
| |
| |
Return the Top Element | |
| |
| |
Pop | |
| |
| |
Copy Stack | |
| |
| |
Constructor and Destructor | |
| |
| |
Copy Constructor | |
| |
| |
Overloading the Assignment Operator (=) | |
| |
| |
Stack Header File | |
| |
| |
Programming Example: Highest GPA | |
| |
| |
Linked Implementation of Stacks | |
| |
| |
Default Constructor | |
| |
| |
Empty Stack and Full Stack | |
| |
| |
Initialize Stack | |
| |
| |
Push | |
| |
| |
Return the Top Element | |
| |
| |
Pop | |
| |
| |
Copy Stack | |
| |
| |
Constructors and Destructors | |
| |
| |
Overloading the Assignment Operator (=) | |
| |
| |
Stack as Derived from the class unorderedLinkedList | |
| |
| |
Application of Stacks: Postfix Expressions Calculator | |
| |
| |
Main Algorithm | |
| |
| |
Function evaluateExpression | |
| |
| |
Function evaluateOpr | |
| |
| |
Function discardExp | |
| |
| |
Function printResult | |
| |
| |
Removing Recursion: Nonrecursive Algorithm to Print a Linked List Backward | |
| |
| |
Queues | |
| |
| |
Queue Operations | |
| |
| |
Implementation of Queues as Arrays | |
| |
| |
Linked Implementation of Queues | |
| |
| |
Queue Derived from the class unorderedLinkedListType | |
| |
| |
Application of Queues: Simulation | |
| |
| |
Designing a Queuing System | |
| |
| |
Customer | |
| |
| |
Server | |
| |
| |
Server List | |
| |
| |
Waiting Customers Queue | |
| |
| |
Main Program | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Searching and Sorting Algorithms | |
| |
| |
Searching and Sorting Algorithms | |
| |
| |
Search Algorithms | |
| |
| |
Sequential Search | |
| |
| |
Binary Search | |
| |
| |
Performance of Binary Search | |
| |
| |
Binary Search Algorithm and the class orderedArrayListType | |
| |
| |
Asymptotic Notation: Big-O Notation | |
| |
| |
Lower Bound on Comparison-Based Search Algorithms | |
| |
| |
Sorting Algorithms | |
| |
| |
Sorting a List: Bubble Sort | |
| |
| |
Analysis: Bubble Sort | |
| |
| |
Bubble Sort Algorithm and the class unorderedArrayListType | |
| |
| |
Selection Sort: Array-Based Lists | |
| |
| |
Analysis: Selection Sort | |
| |
| |
Insertion Sort: Array-Based Lists | |
| |
| |
Analysis: Insertion Sort | |
| |
| |
Lower Bound on Comparison-Based Sort Algorithms | |
| |
| |
Quick Sort: Array-Based Lists | |
| |
| |
Analysis: Quick Sort | |
| |
| |
Merge Sort: Linked List-Based Lists | |
| |
| |
Divide | |
| |
| |
Merge | |
| |
| |
Analysis: Merge Sort | |
| |
| |
Programming Example: Election Results | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Binary Trees | |
| |
| |
Binary Trees | |
| |
| |
Copy Tree | |
| |
| |
Binary Tree Traversal | |
| |
| |
Implementing Binary Trees | |
| |
| |
Binary Search Trees | |
| |
| |
Binary Search Tree: Analysis | |
| |
| |
Nonrecursive Binary Tree Traversal Algorithms | |
| |
| |
Nonrecursive Inorder Traversal | |
| |
| |
Nonrecursive Preorder Traversal | |
| |
| |
Nonrecursive Postorder Traversal | |
| |
| |
Binary Tree Traversal and Functions as Parameters | |
| |
| |
Programming Example: Video Store (Revisited) | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Graphs | |
| |
| |
Introduction | |
| |
| |
Graph Definitions and Notations | |
| |
| |
Graph Representation | |
| |
| |
Adjacency Matrix | |
| |
| |
Adjacency Lists | |
| |
| |
Operations on Graphs | |
| |
| |
Graphs as ADTs | |
| |
| |
Graph Traversals | |
| |
| |
Depth First Traversal | |
| |
| |
Breadth First Traversal | |
| |
| |
Shortest Path Algorithm | |
| |
| |
Shortest Path | |
| |
| |
Minimal Spanning Tree | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Standard Template Library (STL) | |
| |
| |
Components of the STL | |
| |
| |
Container Types | |
| |
| |
Sequence Containers | |
| |
| |
Sequence Container: vector | |
| |
| |
Member Functions Common to All Containers | |
| |
| |
Member Functions Common to Sequence Containers | |
| |
| |
The copy Algorithm | |
| |
| |
Sequence Container: deque | |
| |
| |
Sequence Container: list | |
| |
| |
Iterators | |
| |
| |
Types of Iterators | |
| |
| |
Stream Iterators | |
| |
| |
Associative Containers | |
| |
| |
Associative Containers: set and multiset | |
| |
| |
Declaring set or multiset Associative Containers | |
| |
| |
Item Insertion and Deletion from set/multiset | |
| |
| |
Container Adapters | |
| |
| |
Stack | |
| |
| |
Queue | |
| |
| |
Containers, Associated Header Files, and Iterator Support | |
| |
| |
Algorithms | |
| |
| |
STL Algorithm Classification | |
| |
| |
Function Objects | |
| |
| |
Insert Iterator | |
| |
| |
STL Algorithms | |
| |
| |
The Functions fill and fill_n | |
| |
| |
The Functions generate and generate_n | |
| |
| |
The Functions find, find_if, find_end, and find_first_of | |
| |
| |
The Functions remove, remove_if, remove_copy, and remove_copy_if | |
| |
| |
The Functions replace, replace_if, replace_copy, and replace_copy_if | |
| |
| |
The Functions swap, iter_swap, and swap_ranges | |
| |
| |
The Functions search, search_n, sort, and binary_search | |
| |
| |
The Functions adjacent_find, merge, and inplace_merge | |
| |
| |
The Functions reverse, reverse_copy, rotate, and rotate_copy | |
| |
| |
The Functions count, count_if, max, max_element, min, min_element, and random_shuffle | |
| |
| |
The Functions for_each and transform | |
| |
| |
The Functions includes, set_intersection, set_union, set_difference, and set_symmetric_difference | |
| |
| |
The Functions accumulate, adjacent_difference, inner_product, and partial_sum | |
| |
| |
Quick Review | |
| |
| |
Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Reserved Words | |
| |
| |
| |
Operator Precedence | |
| |
| |
| |
Character Sets | |
| |
| |
ASCII (American Standard Code for Information Interchange) | |
| |
| |
EBCDIC (Extended Binary Coded Decimal Interchange Code) | |
| |
| |
| |
Operator Overloading | |
| |
| |
| |
Additional C++ Topics | |
| |
| |
Binary (Base 2) Representation of a Non-Negative Integer | |
| |
| |
Converting a Base 10 Number to a Binary Number (Base 2) | |
| |
| |
Converting a Binary Number (Base 2) to Base 10 | |
| |
| |
More on File Input/Output | |
| |
| |
Binary Files | |
| |
| |
Random File Access | |
| |
| |
| |
Header Files | |
| |
| |
Header File cassert (assert.h) | |
| |
| |
Header File cctype (ctype.h) | |
| |
| |
Header File cfloat (float.h) | |
| |
| |
Header File climits (limits.h) | |
| |
| |
Header File cmath (math.h) | |
| |
| |
Header File cstddef (stddef.h) | |
| |
| |
Header File cstring (string.h) | |
| |
| |
| |
Memory Size on a System and Random Number Generator | |
| |
| |
Random Number Generator | |
| |
| |
| |
References | |
| |
| |
| |
Answers to Odd Numbered Exercises | |
| |
| |
Chapter 1 | |
| |
| |
Chapter 2 | |
| |
| |
Chapter 3 | |
| |
| |
Chapter 4 | |
| |
| |
Chapter 5 | |
| |
| |
Chapter 6 | |
| |
| |
Chapter 7 | |
| |
| |
Chapter 8 | |
| |
| |
Chapter 9 | |
| |
| |
Chapter 10 | |
| |
| |
Chapter 11 | |
| |
| |
Chapter 12 | |
| |
| |
Chapter 13 | |
| |
| |
Chapter 14 | |
| |
| |
Chapter 15 | |
| |
| |
Chapter 16 | |
| |
| |
Chapter 17 | |
| |
| |
Chapter 18 | |
| |
| |
Chapter 19 | |
| |
| |
Chapter 20 | |
| |
| |
Chapter 21 | |
| |
| |
Chapter 22 | |
| |
| |
Index | |