Preface | p. xxiii |
Introduction to Computers, the Internet and the World Wide Web | p. 1 |
Introduction | p. 2 |
Computers: Hardware and Software | p. 3 |
Computer Organization | p. 4 |
Personal, Distributed and Client/Server Computing | p. 5 |
The Internet and the World Wide Web | p. 6 |
Web 2.0 | p. 6 |
Machine Languages, Assembly Languages and High-Level Languages | p. 7 |
History of C and C++ | p. 8 |
C++ Standard Library | p. 9 |
History of Java | p. 10 |
Fortran, COBOL, Pascal and Ada | p. 11 |
BASIC, Visual Basic, Visual C++, C# and .NET | p. 11 |
Key Software Trend: Object Technology | p. 12 |
Typical C++ Development Environment | p. 13 |
Notes About C++ and C++ How to Program, 7/e | p. 15 |
Test-Driving a C++ Application | p. 16 |
Software Technologies | p. 22 |
Future of C++: Open Source Boost Libraries, TR1 and C++0x | p. 23 |
Software Engineering Case Study: Introduction to Object Technology and the UML | p. 24 |
Wrap-Up | p. 28 |
Web Resources | p. 29 |
Introduction to C++ Programming | p. 39 |
Introduction | p. 40 |
First Program in C++: Printing a Line of Text | p. 40 |
Modifying Our First C++ Program | p. 44 |
Another C++ Program: Adding Integers | p. 45 |
Memory Concepts | p. 49 |
Arithmetic | p. 50 |
Decision Making: Equality and Relational Operators | p. 54 |
Wrap-Up | p. 58 |
Introduction to Classes and Objects | p. 68 |
Introduction | p. 69 |
Classes, Objects, Member Functions and Data Members | p. 69 |
Defining a Class with a Member Function | p. 71 |
Defining a Member Function with a Parameter | p. 74 |
Data Members, set Functions and get Functions | p. 77 |
Initializing Objects with Constructors | p. 84 |
Placing a Class in a Separate File for Reusability | p. 87 |
Separating Interface from Implementation | p. 91 |
Validating Data with set Functions | p. 97 |
Wrap-Up | p. 102 |
Control Statements: Part I | p. 109 |
Introduction | p. 110 |
Algorithms | p. 110 |
Pseudocode | p. 111 |
Control Structures | p. 112 |
if Selection Statement | p. 115 |
if...else Double-Selection Statement | p. 117 |
while Repetition Statement | p. 122 |
Formulating Algorithms: Counter-Controlled Repetition | p. 123 |
Formulating Algorithms: Sentinel-Controlled Repetition | p. 129 |
Formulating Algorithms: Nested Control Statements | p. 139 |
Assignment Operators | p. 144 |
Increment and Decrement Operators | p. 144 |
Wrap-Up | p. 148 |
Control Statements: Part 2 | p. 163 |
Introduction | p. 164 |
Essentials of Counter-Controlled Repetition | p. 164 |
for Repetition Statement | p. 166 |
Examples Using the for Statement | p. 170 |
do...while Repetition Statement | p. 174 |
switch Multiple-Selection Statement | p. 176 |
break and continue Statements | p. 185 |
Logical Operators | p. 187 |
Confusing the Equality (==) and Assignment (=) Operators | p. 191 |
Structured Programming Summary | p. 192 |
Wrap-Up | p. 197 |
Functions and an Introduction to Recursion | p. 207 |
Introduction | p. 208 |
Program Components in C++ | p. 209 |
Math Library Functions | p. 210 |
Function Definitions with Multiple Parameters | p. 211 |
Function Prototypes and Argument Coercion | p. 216 |
C++ Standard Library Header Files | p. 218 |
Case Study: Random Number Generation | p. 220 |
Case Study: Game of Chance; Introducing enum | p. 225 |
Storage Classes | p. 229 |
Scope Rules | p. 231 |
Function Call Stack and Activation Records | p. 235 |
Functions with Empty Parameter Lists | p. 238 |
Inline Functions | p. 239 |
References and Reference Parameters | p. 241 |
Default Arguments | p. 245 |
Unary Scope Resolution Operator | p. 247 |
Function Overloading | p. 248 |
Function Templates | p. 251 |
Recursion | p. 253 |
Example Using Recursion: Fibonacci Series | p. 256 |
Recursion vs. Iteration | p. 259 |
Wrap-Up | p. 262 |
Arrays and Vectors | p. 282 |
Introduction | p. 283 |
Arrays | p. 284 |
Declaring Arrays | p. 285 |
Examples Using Arrays | p. 286 |
Declaring an Array and Using a Loop to Initialize the Array's Elements | p. 286 |
Initializing an Array in a Declaration with an Initializer List | p. 287 |
Specifying an Array's Size with a Constant Variable and Setting Array Elements with Calculations | p. 288 |
Summing the Elements of an Array | p. 291 |
Using Bar Charts to Display Array Data Graphically | p. 291 |
Using the Elements of an Array as Counters | p. 293 |
Using Arrays to Summarize Survey Results | p. 294 |
Static Local Arrays and Automatic Local Arrays | p. 297 |
Passing Arrays to Functions | p. 299 |
Case Study: Class GradeBook Using an Array to Store Grades | p. 303 |
Searching Arrays with Linear Search | p. 309 |
Sorting Arrays with Insertion Sort | p. 311 |
Multidimensional Arrays | p. 313 |
Case Study: Class GradeBook Using a Two-Dimensional Array | p. 316 |
Introduction to C++ Standard Library Class Template vector | p. 323 |
Wrap-Up | p. 328 |
Pointers | p. 345 |
Introduction | p. 346 |
Pointer Variable Declarations and Initialization | p. 346 |
Pointer Operators | p. 348 |
Pass-by-Reference with Pointers | p. 350 |
Using const with Pointers | p. 354 |
Selection Sort Using Pass-by-Reference | p. 358 |
size of Operator | p. 362 |
Pointer Expressions and Pointer Arithmetic | p. 365 |
Relationship Between Pointers and Arrays | p. 367 |
Pointer-Based String Processing | p. 370 |
Arrays of Pointers | p. 373 |
Function Pointers | p. 374 |
Wrap-Up | p. 377 |
Classes: A Deeper Look, Part I | p. 395 |
Introduction | p. 396 |
Time Class Case Study | p. 397 |
Class Scope and Accessing Class Members | p. 403 |
Separating Interface from Implementation | p. 405 |
Access Functions and Utility Functions | p. 406 |
Time Class Case Study: Constructors with Default Arguments | p. 409 |
Destructors | p. 414 |
When Constructors and Destructors Are Called | p. 415 |
Time Class Case Study: A Subtle Trap-Returning a Reference to a private Data Member | p. 418 |
Default Memberwise Assignment | p. 421 |
Wrap-Up | p. 423 |
Classes: A Deeper Look, Part 2 | p. 429 |
Introduction | p. 430 |
const (Constant) Objects and const Member Functions | p. 430 |
Composition: Objects as Members of Classes | p. 439 |
friend Functions and friend Classes | p. 445 |
Using the this Pointer | p. 448 |
static Class Members | p. 453 |
Data Abstraction and Information Hiding | p. 458 |
Wrap-Up | p. 460 |
Operator Overloading | p. 466 |
Introduction | p. 467 |
Fundamentals of Operator Overloading | p. 468 |
Restrictions on Operator Overloading | p. 469 |
Operator Functions as Class Members vs. Global Functions | p. 470 |
Overloading Stream Insertion and Stream Extraction Operators | p. 472 |
Overloading Unary Operators | p. 475 |
Overloading Binary Operators | p. 476 |
Dynamic Memory Management | p. 476 |
Case Study: Array Class | p. 478 |
Converting between Types | p. 490 |
Building a String Class | p. 491 |
Overloading ++ and -- | p. 492 |
Case Study: A Date Class | p. 494 |
Standard Library Class string | p. 498 |
explicit Constructors | p. 502 |
Proxy Classes | p. 505 |
Wrap-Up | p. 509 |
Object-Oriented Programming: Inheritance | p. 521 |
Introduction | p. 522 |
Base Classes and Derived Classes | p. 523 |
protected Members | p. 526 |
Relationship between Base Classes and Derived Classes | p. 526 |
Creating and Using a CommissionEmployee Class | p. 527 |
Creating a BasePlusCommissionEmployee Class Without Using Inheritance | p. 532 |
Creating a CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchy | p. 537 |
CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchy Using protected Data | p. 542 |
CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchy Using private Data | p. 549 |
Constructors and Destructors in Derived Classes | p. 556 |
public, protected and private Inheritance | p. 564 |
Software Engineering with Inheritance | p. 565 |
Wrap-Up | p. 566 |
Object-Oriented Programming: Polymorphism | p. 572 |
Introduction | p. 573 |
Polymorphism Examples | p. 574 |
Relationships Among Objects in an Inheritance Hierarchy | p. 575 |
Invoking Base-Class Functions from Derived-Class Objects | p. 576 |
Aiming Derived-Class Pointers at Base-Class Objects | p. 583 |
Derived-Class Member-Function Calls via Base-Class Pointers | p. 584 |
Virtual Functions | p. 586 |
Summary of the Allowed Assignments Between Base-Class and Derived-Class Objects and Pointers | p. 592 |
Type Fields and switch Statements | p. 593 |
Abstract Classes and Pure virtual Functions | p. 593 |
Case Study: Payroll System Using Polymorphism | p. 595 |
Creating Abstract Base Class Employee | p. 597 |
Creating Concrete Derived Class SalariedEmployee | p. 600 |
Creating Concrete Derived Class HourlyEmployee | p. 602 |
Creating Concrete Derived Class CommissionEmployee | p. 605 |
Creating Indirect Concrete Derived Class BasePlusCommissionEmployee | p. 607 |
Demonstrating Polymorphic Processing | p. 608 |
(Optional) Polymorphism, Virtual Functions and Dynamic Binding "Under the Hood" | p. 612 |
Case Study: Payroll System Using Polymorphism and Runtime Type Information with Downcasting, dynamic_cast, typeid and type_info | p. 616 |
Virtual Destructors | p. 620 |
Wrap-Up | p. 620 |
Templates | p. 626 |
Introduction | p. 627 |
Function Templates | p. 628 |
Overloading Function Templates | p. 631 |
Class Templates | p. 631 |
Nontype Parameters and Default Types for Class Templates | p. 638 |
Notes on Templates and Inheritance | p. 639 |
Notes on Templates and Friends | p. 639 |
Notes on Templates and static Members | p. 640 |
Wrap-Up | p. 640 |
Stream Input/Output | p. 645 |
Introduction | p. 646 |
Streams | p. 647 |
Classic Streams vs. Standard Streams | p. 647 |
iostream Library Header Files | p. 648 |
Stream Input/Output Classes and Objects | p. 648 |
Stream Output | p. 651 |
Output of char * Variables | p. 651 |
Character Output Using Member Function put | p. 651 |
Stream Input | p. 652 |
get and getline Member Functions | p. 652 |
istream Member Functions peek, putback and ignore | p. 655 |
Type-Safe I/O | p. 655 |
Unformatted I/O Using read, write and gcount | p. 655 |
Introduction to Stream Manipulators | p. 656 |
Integral Stream Base: dec, oct, hex and setbase | p. 657 |
Floating-Point Precision (precision, setprecision) | p. 658 |
Field Width (width, setw) | p. 659 |
User-Defined Output Stream Manipulators | p. 660 |
Stream Format States and Stream Manipulators | p. 662 |
Trailing Zeros and Decimal Points (showpoint) | p. 662 |
Justification (left, right and internal) | p. 663 |
Padding (fill, setfill) | p. 665 |
Integral Stream Base (dec, oct, hex, showbase) | p. 666 |
Floating-Point Numbers; Scientific and Fixed Notation (scientific, fixed) | p. 667 |
Uppercase/Lowercase Control (uppercase) | p. 668 |
Specifying Boolean Format (boolalpha) | p. 668 |
Setting and Resetting the Format State via Member Function flags | p. 669 |
Stream Error States | p. 671 |
Tying an Output Stream to an Input Stream | p. 673 |
Wrap-Up | p. 673 |
Exception Handling | p. 683 |
Introduction | p. 684 |
Exception-Handling Overview | p. 685 |
Example: Handling an Attempt to Divide by Zero | p. 685 |
When to Use Exception Handling | p. 691 |
Rethrowing an Exception | p. 692 |
Exception Specifications | p. 694 |
Processing Unexpected Exceptions | p. 695 |
Stack Unwinding | p. 695 |
Constructors, Destructors and Exception Handling | p. 697 |
Exceptions and Inheritance | p. 698 |
Processing new Failures | p. 698 |
Class auto_ptr and Dynamic Memory Allocation | p. 701 |
Standard Library Exception Hierarchy | p. 703 |
Other Error-Handling Techniques | p. 705 |
Wrap-Up | p. 706 |
File Processing | p. 713 |
Introduction | p. 714 |
Data Hierarchy | p. 714 |
Files and Streams | p. 716 |
Creating a Sequential File | p. 717 |
Reading Data from a Sequential File | p. 721 |
Updating Sequential Files | p. 726 |
Random-Access Files | p. 727 |
Creating a Random-Access File | p. 728 |
Writing Data Randomly to a Random-Access File | p. 733 |
Reading from a Random-Access File Sequentially | p. 735 |
Case Study: A Transaction-Processing Program | p. 737 |
Overview of Object Serialization | p. 743 |
Wrap-Up | p. 744 |
Class string and String Stream Processing | p. 755 |
Introduction | p. 756 |
string Assignment and Concatenation | p. 757 |
Comparing Strings | p. 759 |
Substrings | p. 762 |
Swapping strings | p. 762 |
string Characteristics | p. 763 |
Finding Substrings and Characters in a string | p. 766 |
Replacing Characters in a string | p. 768 |
Inserting Characters into a string | p. 769 |
Conversion to C-Style Pointer-Based char * Strings | p. 770 |
Iterators | p. 772 |
String Stream Processing | p. 773 |
Wrap-Up | p. 776 |
Searching and Sorting | p. 784 |
Introduction | p. 785 |
Searching Algorithms | p. 786 |
Efficiency of Linear Search | p. 786 |
Binary Search | p. 788 |
Sorting Algorithms | p. 793 |
Efficiency of Selection Sort | p. 793 |
Efficiency of Insertion Sort | p. 793 |
Merge Sort (A Recursive Implementation) | p. 794 |
Wrap-Up | p. 801 |
Data Structures | p. 806 |
Introduction | p. 807 |
Self-Referential Classes | p. 808 |
Dynamic Memory Allocation and Data Structures | p. 809 |
Linked Lists | p. 809 |
Stacks | p. 824 |
Queues | p. 829 |
Trees | p. 832 |
Wrap-Up | p. 841 |
Bits, Characters, C Strings and structs | p. 852 |
Introduction | p. 853 |
Structure Definitions | p. 853 |
Initializing Structures | p. 856 |
Using Structures with Functions | p. 856 |
typedef | p. 856 |
Example: Card Shuffling and Dealing Simulation | p. 857 |
Bitwise Operators | p. 860 |
Bit Fields | p. 869 |
Character-Handling Library | p. 873 |
Pointer-Based String Manipulation Functions | p. 878 |
Pointer-Based String-Conversion Functions | p. 885 |
Search Functions of the Pointer-Based String-Handling Library | p. 890 |
Memory Functions of the Pointer-Based String-Handling Library | p. 895 |
Wrap-Up | p. 899 |
Standard Template Library (STL) | p. 916 |
Introduction to the Standard Template Library (STL) | p. 917 |
Introduction to Containers | p. 919 |
Introduction to Iterators | p. 923 |
Introduction to Algorithms | p. 928 |
Sequence Containers | p. 930 |
Vector Sequence Container | p. 930 |
list Sequence Container | p. 938 |
deque Sequence Container | p. 942 |
Associative Containers | p. 944 |
multiset Associative Container | p. 944 |
Set Associative Container | p. 947 |
multimap Associative Container | p. 948 |
map Associative Container | p. 950 |
Container Adapters | p. 952 |
stack Adapter | p. 952 |
queue Adapter | p. 954 |
priority_queue Adapter | p. 955 |
Algorithms | p. 957 |
fill, fill_n, generate and generate_n | p. 958 |
equal, mismatch and lexicographical_compare | p. 959 |
remove, remove_if, remove_copy and remove_copy_if | p. 962 |
replace, replace_if, replace_copy and replace_copy_if | p. 964 |
Mathematical Algorithms | p. 967 |
Basic Searching and Sorting Algorithms | p. 970 |
swap, iter_swap and swap_ranges | p. 972 |
copy_backward, merge, unique and reverse | p. 973 |
inplace_merge, unique_copy and reverse_copy | p. 976 |
Set Operations | p. 977 |
lower_bound, upper_bound and equal_range | p. 980 |
Heapsort | p. 982 |
min and max | p. 985 |
STL Algorithms Not Covered in This Chapter | p. 986 |
Class bitset | p. 987 |
Function Objects | p. 991 |
Wrap-Up | p. 994 |
STL Web Resources | p. 995 |
Chapters on the Web: Chapters 23-27 are PDF documents posted online at the book's Companion Website (located at www.pearsonhighered.com/deitel). | p. 1005 |
Boost Libraries, Technical Report I and C++0x | p. I |
Introduction | p. II |
Deitel Online C++ and Related Resource Centers | p. II |
Boost Libraries | p. II |
Boost Libraries Overview | p. III |
Regular Expressions with the Boost.Regex Library | p. VI |
Regular Expression Example | p. VI |
Validating User Input with Regular Expressions | p. IX |
Replacing and Splitting Strings | p. XII |
Smart Pointers with Boost.Smart_ptr | p. XIV |
Reference Counted shared_ptr | p. XIV |
weak_ptr: shared_ptr Observer | p. XIX |
Technical Report 1 | p. XXIV |
C++0x | p. XXVI |
Core Language Changes | p. XXVI |
Wrap_Up | p. XXXI |
Other Topics | p. XL |
Introduction | p. XLI |
const_cast Operator | p. XLI |
mutable Class Members | p. XLIII |
namespaces | p. XLV |
Operator Keywords | p. XLVIII |
Pointers to Class Members (.* and ->*) | p. L |
Multiple Inheritance | p. LII |
Multiple Inheritance and virtual Base Classes | p. LVII |
Wrap-Up | p. LXII |
ATM Case Study, Part I: Object-Oriented Design with the UML | p. LXVII |
Introduction | p. LXVIII |
Examining the ATM Requirements Document | p. LXVIII |
Identifying the Classes in the ATM Requirements Document | p. LXXVI |
Identifying Class Attributes | p. LXXXIII |
Identifying Objects' States and Activities | p. LXXXVII |
Identifying Class Operations | p. XCI |
Indicating Collaboration Among Objects | p. XCVIII |
Wrap-Up | p. CV |
ATM Case Study, Part 2: Implementing an Object-Oriented Design | p. CIX |
Introduction | p. CX |
Starting to Program the Classes of the ATM System | p. CX |
Incorporating Inheritance into the ATM System | p. CXVII |
ATM Case Study Implementation | p. CXXIV |
Class ATM | p. CXXIV |
Class Screen | p. CXXXII |
Class Keypad | p. CXXXIII |
Class CashDispenser | p. CXXXIV |
Class DepositSlot | p. CXXXVI |
Class Account | p. CXXXVII |
Class BankDatabase | p. CXXXIX |
Class Transaction | p. CXLIII |
Class BalanceInquiry | p. CXLV |
Class Withdrawal | p. CXLVII |
Class Deposit | p. CLII |
Test Program ATMCaseStudy.cpp | p. CLV |
Wrap-Up | p. CLV |
Game Programming with Ogre | p. CLVIII |
Introduction | p. CLIX |
Installing Ogre, OgreAL and OpenAL | p. CLIX |
Basics of Game Programming | p. CLIX |
The Game of Pong: Code Walkthrough | p. CLXII |
Ogre Initialization | p. CLXIII |
Creating a Scene | p. CLXXII |
Adding to the Scene | p. CLXXIII |
Animation and Timers | p. CLXXXV |
User Input | p. CLXXXVI |
Collision Detection | p. CLXXXVIII |
Sound | p. CXCII |
Resources | p. CXCIII |
Pong Driver | p. CXCIV |
Wrap-Up | p. CXCV |
Ogre Web Resources | p. CXCV |
Operator Precedence and Associativity | p. 1006 |
ASCII Character Set | p. 1008 |
Fundamental Types | p. 1009 |
Number Systems | p. 1011 |
Introduction | p. 1012 |
Abbreviating Binary Numbers as Octal and Hexadecimal Numbers | p. 1015 |
Converting Octal and Hexadecimal Numbers to Binary Numbers | p. 1016 |
Converting from Binary, Octal or Hexadecimal to Decimal | p. 1016 |
Converting from Decimal to Binary, Octal or Hexadecimal | p. 1017 |
Negative Binary Numbers: Two's Complement Notation | p. 1019 |
Preprocessor | p. 1024 |
Introduction | p. 1025 |
#include Preprocessor Directive | p. 1025 |
#define Preprocessor Directive: Symbolic Constants | p. 1026 |
#define Preprocessor Directive: Macros | p. 1026 |
Conditional Compilation | p. 1028 |
#error and #pragma Preprocessor Directives | p. 1029 |
Operators # and ## | p. 1030 |
Predefined Symbolic Constants | p. 1030 |
Assertions | p. 1031 |
Wrap-Up | p. 1031 |
Appendices on the Web: Appendices F-I are PDF documents posted online at the book's Companion Website (located at www.pearsonhighered.com/deitel). | p. 1036 |
C Legacy Code Topics | p. CCV |
Introduction | p. CCVI |
Redirecting Input/Output on UNIX/Linux/Mac OS X and Windows Systems | p. CCVI |
Variable-Length Argument Lists | p. CCVII |
Using Command-Line Arguments | p. CCIX |
Notes on Compiling Multiple-Source-File Programs | p. CCXI |
Program Termination with exit and atexit | p. CCXIII |
Type Qualifier volatile | p. CCXIV |
Suffixes for Integer and Floating-Point Constants | p. CCXIV |
Signal Handling | p. CCXV |
Dynamic Memory Allocation with calloc and realloc | p. CCXVII |
Unconditional Branch: goto | p. CCXVIII |
Unions | p. CCXIX |
Linkage Specifications | p. CCXXII |
Wrap-Up | p. CCXXIII |
UML 2: Additional Diagram Types | p. CCXXIX |
Introduction | p. CCXXIX |
Additional Diagram Types | p. CCXXIX |
Using the Visual Studio Debugger | p. CCXXXI |
Introduction | p. CCXXXII |
Breakpoints and the Continue Command | p. CCXXXII |
Locals and Watch Windows | p. CCXXXVIII |
Controlling Execution Using the Step Into, Step Over, Step Out and Continue Commands | p. CCXLI |
Autos Window | p. CCXLIII |
Wrap-Up | p. CCXLIV |
Using the GNU C++ Debugger | p. CCXLVII |
Introduction | p. CCXLVIII |
Breakpoints and the run, stop, continue and print Commands | p. CCXLVIII |
print and set Commands | p. CCLIV |
Controlling Execution Using the step, finish and next Commands | p. CCLVI |
watch Command | p. CCLIX |
Wrap-Up | p. CCLXI |
Index | p. 1037 |
Table of Contents provided by Ingram. All Rights Reserved. |
The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.
The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.