C++ How to Program

by ;
  • ISBN13:


  • ISBN10:


  • Edition: 7th
  • Format: Paperback w/CD
  • Copyright: 2010-01-01
  • Publisher: Prentice Hall
  • View Upgraded Edition
  • Purchase Benefits
  • Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $135.00


KEY BENEFIT: This comprehensive best-seller is aimed at readers with little or no programming experience. It teaches by presenting the concepts in the context of full working programs and takes an early-objects approach. The authors emphasize achieving program clarity through structured and object-oriented programming, software reuse and component-oriented software construction. KEY TOPICS: Introduction to Computers, the Internet and World Wide Web; Introduction to C++ Programming; Introduction to Classes and Objects; Control Statements: Part 1; Control Statements: Part 2; Functions and an Introduction to Recursion; Arrays and Vectors; Pointers and Pointer-Based Strings; Classes: A Deeper Look, Part 1; Classes: A Deeper Look, Part 2; Object-Oriented Programming: Inheritance; Object-Oriented Programming: Polymorphism; (Optional) ATM Case Study, Part 1: Object-Oriented Design with the UML; (Optional) ATM Case Study, Part 2: Implementing an Object-Oriented Design; Exception Handling; Templates; Operator Overloading; String and Array Objects; String Processing with Class string; Stream Input/Output; File and String Stream Processing; Searching and Sorting; Data Structures; Standard Template Library (STL); Bits, Characters, C-Strings and structs; Game Programming with Ogre; Boost Libraries, Technical Report 1 and C++0x; Other Topics; Operator Precedence and Associativity Chart; ASCII Character Set; Fundamental Types; Number Systems; C Legacy Code Topics; Preprocessor; UML 2: Additional Diagram Types; Using the Visual Studioreg; 2008 Debugger; Using the GNUtrade; C++ Debugger. MARKET: A useful reference for programmers.

Table of Contents

Prefacep. xxiii
Introduction to Computers, the Internet and the World Wide Webp. 1
Introductionp. 2
Computers: Hardware and Softwarep. 3
Computer Organizationp. 4
Personal, Distributed and Client/Server Computingp. 5
The Internet and the World Wide Webp. 6
Web 2.0p. 6
Machine Languages, Assembly Languages and High-Level Languagesp. 7
History of C and C++p. 8
C++ Standard Libraryp. 9
History of Javap. 10
Fortran, COBOL, Pascal and Adap. 11
BASIC, Visual Basic, Visual C++, C# and .NETp. 11
Key Software Trend: Object Technologyp. 12
Typical C++ Development Environmentp. 13
Notes About C++ and C++ How to Program, 7/ep. 15
Test-Driving a C++ Applicationp. 16
Software Technologiesp. 22
Future of C++: Open Source Boost Libraries, TR1 and C++0xp. 23
Software Engineering Case Study: Introduction to Object Technology and the UMLp. 24
Wrap-Upp. 28
Web Resourcesp. 29
Introduction to C++ Programmingp. 39
Introductionp. 40
First Program in C++: Printing a Line of Textp. 40
Modifying Our First C++ Programp. 44
Another C++ Program: Adding Integersp. 45
Memory Conceptsp. 49
Arithmeticp. 50
Decision Making: Equality and Relational Operatorsp. 54
Wrap-Upp. 58
Introduction to Classes and Objectsp. 68
Introductionp. 69
Classes, Objects, Member Functions and Data Membersp. 69
Defining a Class with a Member Functionp. 71
Defining a Member Function with a Parameterp. 74
Data Members, set Functions and get Functionsp. 77
Initializing Objects with Constructorsp. 84
Placing a Class in a Separate File for Reusabilityp. 87
Separating Interface from Implementationp. 91
Validating Data with set Functionsp. 97
Wrap-Upp. 102
Control Statements: Part Ip. 109
Introductionp. 110
Algorithmsp. 110
Pseudocodep. 111
Control Structuresp. 112
if Selection Statementp. 115
if...else Double-Selection Statementp. 117
while Repetition Statementp. 122
Formulating Algorithms: Counter-Controlled Repetitionp. 123
Formulating Algorithms: Sentinel-Controlled Repetitionp. 129
Formulating Algorithms: Nested Control Statementsp. 139
Assignment Operatorsp. 144
Increment and Decrement Operatorsp. 144
Wrap-Upp. 148
Control Statements: Part 2p. 163
Introductionp. 164
Essentials of Counter-Controlled Repetitionp. 164
for Repetition Statementp. 166
Examples Using the for Statementp. 170
do...while Repetition Statementp. 174
switch Multiple-Selection Statementp. 176
break and continue Statementsp. 185
Logical Operatorsp. 187
Confusing the Equality (==) and Assignment (=) Operatorsp. 191
Structured Programming Summaryp. 192
Wrap-Upp. 197
Functions and an Introduction to Recursionp. 207
Introductionp. 208
Program Components in C++p. 209
Math Library Functionsp. 210
Function Definitions with Multiple Parametersp. 211
Function Prototypes and Argument Coercionp. 216
C++ Standard Library Header Filesp. 218
Case Study: Random Number Generationp. 220
Case Study: Game of Chance; Introducing enump. 225
Storage Classesp. 229
Scope Rulesp. 231
Function Call Stack and Activation Recordsp. 235
Functions with Empty Parameter Listsp. 238
Inline Functionsp. 239
References and Reference Parametersp. 241
Default Argumentsp. 245
Unary Scope Resolution Operatorp. 247
Function Overloadingp. 248
Function Templatesp. 251
Recursionp. 253
Example Using Recursion: Fibonacci Seriesp. 256
Recursion vs. Iterationp. 259
Wrap-Upp. 262
Arrays and Vectorsp. 282
Introductionp. 283
Arraysp. 284
Declaring Arraysp. 285
Examples Using Arraysp. 286
Declaring an Array and Using a Loop to Initialize the Array's Elementsp. 286
Initializing an Array in a Declaration with an Initializer Listp. 287
Specifying an Array's Size with a Constant Variable and Setting Array Elements with Calculationsp. 288
Summing the Elements of an Arrayp. 291
Using Bar Charts to Display Array Data Graphicallyp. 291
Using the Elements of an Array as Countersp. 293
Using Arrays to Summarize Survey Resultsp. 294
Static Local Arrays and Automatic Local Arraysp. 297
Passing Arrays to Functionsp. 299
Case Study: Class GradeBook Using an Array to Store Gradesp. 303
Searching Arrays with Linear Searchp. 309
Sorting Arrays with Insertion Sortp. 311
Multidimensional Arraysp. 313
Case Study: Class GradeBook Using a Two-Dimensional Arrayp. 316
Introduction to C++ Standard Library Class Template vectorp. 323
Wrap-Upp. 328
Pointersp. 345
Introductionp. 346
Pointer Variable Declarations and Initializationp. 346
Pointer Operatorsp. 348
Pass-by-Reference with Pointersp. 350
Using const with Pointersp. 354
Selection Sort Using Pass-by-Referencep. 358
size of Operatorp. 362
Pointer Expressions and Pointer Arithmeticp. 365
Relationship Between Pointers and Arraysp. 367
Pointer-Based String Processingp. 370
Arrays of Pointersp. 373
Function Pointersp. 374
Wrap-Upp. 377
Classes: A Deeper Look, Part Ip. 395
Introductionp. 396
Time Class Case Studyp. 397
Class Scope and Accessing Class Membersp. 403
Separating Interface from Implementationp. 405
Access Functions and Utility Functionsp. 406
Time Class Case Study: Constructors with Default Argumentsp. 409
Destructorsp. 414
When Constructors and Destructors Are Calledp. 415
Time Class Case Study: A Subtle Trap-Returning a Reference to a private Data Memberp. 418
Default Memberwise Assignmentp. 421
Wrap-Upp. 423
Classes: A Deeper Look, Part 2p. 429
Introductionp. 430
const (Constant) Objects and const Member Functionsp. 430
Composition: Objects as Members of Classesp. 439
friend Functions and friend Classesp. 445
Using the this Pointerp. 448
static Class Membersp. 453
Data Abstraction and Information Hidingp. 458
Wrap-Upp. 460
Operator Overloadingp. 466
Introductionp. 467
Fundamentals of Operator Overloadingp. 468
Restrictions on Operator Overloadingp. 469
Operator Functions as Class Members vs. Global Functionsp. 470
Overloading Stream Insertion and Stream Extraction Operatorsp. 472
Overloading Unary Operatorsp. 475
Overloading Binary Operatorsp. 476
Dynamic Memory Managementp. 476
Case Study: Array Classp. 478
Converting between Typesp. 490
Building a String Classp. 491
Overloading ++ and --p. 492
Case Study: A Date Classp. 494
Standard Library Class stringp. 498
explicit Constructorsp. 502
Proxy Classesp. 505
Wrap-Upp. 509
Object-Oriented Programming: Inheritancep. 521
Introductionp. 522
Base Classes and Derived Classesp. 523
protected Membersp. 526
Relationship between Base Classes and Derived Classesp. 526
Creating and Using a CommissionEmployee Classp. 527
Creating a BasePlusCommissionEmployee Class Without Using Inheritancep. 532
Creating a CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchyp. 537
CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchy Using protected Datap. 542
CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchy Using private Datap. 549
Constructors and Destructors in Derived Classesp. 556
public, protected and private Inheritancep. 564
Software Engineering with Inheritancep. 565
Wrap-Upp. 566
Object-Oriented Programming: Polymorphismp. 572
Introductionp. 573
Polymorphism Examplesp. 574
Relationships Among Objects in an Inheritance Hierarchyp. 575
Invoking Base-Class Functions from Derived-Class Objectsp. 576
Aiming Derived-Class Pointers at Base-Class Objectsp. 583
Derived-Class Member-Function Calls via Base-Class Pointersp. 584
Virtual Functionsp. 586
Summary of the Allowed Assignments Between Base-Class and Derived-Class Objects and Pointersp. 592
Type Fields and switch Statementsp. 593
Abstract Classes and Pure virtual Functionsp. 593
Case Study: Payroll System Using Polymorphismp. 595
Creating Abstract Base Class Employeep. 597
Creating Concrete Derived Class SalariedEmployeep. 600
Creating Concrete Derived Class HourlyEmployeep. 602
Creating Concrete Derived Class CommissionEmployeep. 605
Creating Indirect Concrete Derived Class BasePlusCommissionEmployeep. 607
Demonstrating Polymorphic Processingp. 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_infop. 616
Virtual Destructorsp. 620
Wrap-Upp. 620
Templatesp. 626
Introductionp. 627
Function Templatesp. 628
Overloading Function Templatesp. 631
Class Templatesp. 631
Nontype Parameters and Default Types for Class Templatesp. 638
Notes on Templates and Inheritancep. 639
Notes on Templates and Friendsp. 639
Notes on Templates and static Membersp. 640
Wrap-Upp. 640
Stream Input/Outputp. 645
Introductionp. 646
Streamsp. 647
Classic Streams vs. Standard Streamsp. 647
iostream Library Header Filesp. 648
Stream Input/Output Classes and Objectsp. 648
Stream Outputp. 651
Output of char * Variablesp. 651
Character Output Using Member Function putp. 651
Stream Inputp. 652
get and getline Member Functionsp. 652
istream Member Functions peek, putback and ignorep. 655
Type-Safe I/Op. 655
Unformatted I/O Using read, write and gcountp. 655
Introduction to Stream Manipulatorsp. 656
Integral Stream Base: dec, oct, hex and setbasep. 657
Floating-Point Precision (precision, setprecision)p. 658
Field Width (width, setw)p. 659
User-Defined Output Stream Manipulatorsp. 660
Stream Format States and Stream Manipulatorsp. 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 flagsp. 669
Stream Error Statesp. 671
Tying an Output Stream to an Input Streamp. 673
Wrap-Upp. 673
Exception Handlingp. 683
Introductionp. 684
Exception-Handling Overviewp. 685
Example: Handling an Attempt to Divide by Zerop. 685
When to Use Exception Handlingp. 691
Rethrowing an Exceptionp. 692
Exception Specificationsp. 694
Processing Unexpected Exceptionsp. 695
Stack Unwindingp. 695
Constructors, Destructors and Exception Handlingp. 697
Exceptions and Inheritancep. 698
Processing new Failuresp. 698
Class auto_ptr and Dynamic Memory Allocationp. 701
Standard Library Exception Hierarchyp. 703
Other Error-Handling Techniquesp. 705
Wrap-Upp. 706
File Processingp. 713
Introductionp. 714
Data Hierarchyp. 714
Files and Streamsp. 716
Creating a Sequential Filep. 717
Reading Data from a Sequential Filep. 721
Updating Sequential Filesp. 726
Random-Access Filesp. 727
Creating a Random-Access Filep. 728
Writing Data Randomly to a Random-Access Filep. 733
Reading from a Random-Access File Sequentiallyp. 735
Case Study: A Transaction-Processing Programp. 737
Overview of Object Serializationp. 743
Wrap-Upp. 744
Class string and String Stream Processingp. 755
Introductionp. 756
string Assignment and Concatenationp. 757
Comparing Stringsp. 759
Substringsp. 762
Swapping stringsp. 762
string Characteristicsp. 763
Finding Substrings and Characters in a stringp. 766
Replacing Characters in a stringp. 768
Inserting Characters into a stringp. 769
Conversion to C-Style Pointer-Based char * Stringsp. 770
Iteratorsp. 772
String Stream Processingp. 773
Wrap-Upp. 776
Searching and Sortingp. 784
Introductionp. 785
Searching Algorithmsp. 786
Efficiency of Linear Searchp. 786
Binary Searchp. 788
Sorting Algorithmsp. 793
Efficiency of Selection Sortp. 793
Efficiency of Insertion Sortp. 793
Merge Sort (A Recursive Implementation)p. 794
Wrap-Upp. 801
Data Structuresp. 806
Introductionp. 807
Self-Referential Classesp. 808
Dynamic Memory Allocation and Data Structuresp. 809
Linked Listsp. 809
Stacksp. 824
Queuesp. 829
Treesp. 832
Wrap-Upp. 841
Bits, Characters, C Strings and structsp. 852
Introductionp. 853
Structure Definitionsp. 853
Initializing Structuresp. 856
Using Structures with Functionsp. 856
typedefp. 856
Example: Card Shuffling and Dealing Simulationp. 857
Bitwise Operatorsp. 860
Bit Fieldsp. 869
Character-Handling Libraryp. 873
Pointer-Based String Manipulation Functionsp. 878
Pointer-Based String-Conversion Functionsp. 885
Search Functions of the Pointer-Based String-Handling Libraryp. 890
Memory Functions of the Pointer-Based String-Handling Libraryp. 895
Wrap-Upp. 899
Standard Template Library (STL)p. 916
Introduction to the Standard Template Library (STL)p. 917
Introduction to Containersp. 919
Introduction to Iteratorsp. 923
Introduction to Algorithmsp. 928
Sequence Containersp. 930
Vector Sequence Containerp. 930
list Sequence Containerp. 938
deque Sequence Containerp. 942
Associative Containersp. 944
multiset Associative Containerp. 944
Set Associative Containerp. 947
multimap Associative Containerp. 948
map Associative Containerp. 950
Container Adaptersp. 952
stack Adapterp. 952
queue Adapterp. 954
priority_queue Adapterp. 955
Algorithmsp. 957
fill, fill_n, generate and generate_np. 958
equal, mismatch and lexicographical_comparep. 959
remove, remove_if, remove_copy and remove_copy_ifp. 962
replace, replace_if, replace_copy and replace_copy_ifp. 964
Mathematical Algorithmsp. 967
Basic Searching and Sorting Algorithmsp. 970
swap, iter_swap and swap_rangesp. 972
copy_backward, merge, unique and reversep. 973
inplace_merge, unique_copy and reverse_copyp. 976
Set Operationsp. 977
lower_bound, upper_bound and equal_rangep. 980
Heapsortp. 982
min and maxp. 985
STL Algorithms Not Covered in This Chapterp. 986
Class bitsetp. 987
Function Objectsp. 991
Wrap-Upp. 994
STL Web Resourcesp. 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++0xp. I
Introductionp. II
Deitel Online C++ and Related Resource Centersp. II
Boost Librariesp. II
Boost Libraries Overviewp. III
Regular Expressions with the Boost.Regex Libraryp. VI
Regular Expression Examplep. VI
Validating User Input with Regular Expressionsp. IX
Replacing and Splitting Stringsp. XII
Smart Pointers with Boost.Smart_ptrp. XIV
Reference Counted shared_ptrp. XIV
weak_ptr: shared_ptr Observerp. XIX
Technical Report 1p. XXIV
C++0xp. XXVI
Core Language Changesp. XXVI
Wrap_Upp. XXXI
Other Topicsp. XL
Introductionp. XLI
const_cast Operatorp. XLI
mutable Class Membersp. XLIII
namespacesp. XLV
Operator Keywordsp. XLVIII
Pointers to Class Members (.* and ->*)p. L
Multiple Inheritancep. LII
Multiple Inheritance and virtual Base Classesp. LVII
Wrap-Upp. LXII
ATM Case Study, Part I: Object-Oriented Design with the UMLp. LXVII
Introductionp. LXVIII
Examining the ATM Requirements Documentp. LXVIII
Identifying the Classes in the ATM Requirements Documentp. LXXVI
Identifying Class Attributesp. LXXXIII
Identifying Objects' States and Activitiesp. LXXXVII
Identifying Class Operationsp. XCI
Indicating Collaboration Among Objectsp. XCVIII
Wrap-Upp. CV
ATM Case Study, Part 2: Implementing an Object-Oriented Designp. CIX
Introductionp. CX
Starting to Program the Classes of the ATM Systemp. CX
Incorporating Inheritance into the ATM Systemp. CXVII
ATM Case Study Implementationp. CXXIV
Class Screenp. CXXXII
Class Keypadp. CXXXIII
Class CashDispenserp. CXXXIV
Class DepositSlotp. CXXXVI
Class Accountp. CXXXVII
Class BankDatabasep. CXXXIX
Class Transactionp. CXLIII
Class BalanceInquiryp. CXLV
Class Withdrawalp. CXLVII
Class Depositp. CLII
Test Program ATMCaseStudy.cppp. CLV
Wrap-Upp. CLV
Game Programming with Ogrep. CLVIII
Introductionp. CLIX
Installing Ogre, OgreAL and OpenALp. CLIX
Basics of Game Programmingp. CLIX
The Game of Pong: Code Walkthroughp. CLXII
Ogre Initializationp. CLXIII
Creating a Scenep. CLXXII
Adding to the Scenep. CLXXIII
Animation and Timersp. CLXXXV
User Inputp. CLXXXVI
Collision Detectionp. CLXXXVIII
Soundp. CXCII
Resourcesp. CXCIII
Pong Driverp. CXCIV
Wrap-Upp. CXCV
Ogre Web Resourcesp. CXCV
Operator Precedence and Associativityp. 1006
ASCII Character Setp. 1008
Fundamental Typesp. 1009
Number Systemsp. 1011
Introductionp. 1012
Abbreviating Binary Numbers as Octal and Hexadecimal Numbersp. 1015
Converting Octal and Hexadecimal Numbers to Binary Numbersp. 1016
Converting from Binary, Octal or Hexadecimal to Decimalp. 1016
Converting from Decimal to Binary, Octal or Hexadecimalp. 1017
Negative Binary Numbers: Two's Complement Notationp. 1019
Preprocessorp. 1024
Introductionp. 1025
#include Preprocessor Directivep. 1025
#define Preprocessor Directive: Symbolic Constantsp. 1026
#define Preprocessor Directive: Macrosp. 1026
Conditional Compilationp. 1028
#error and #pragma Preprocessor Directivesp. 1029
Operators # and ##p. 1030
Predefined Symbolic Constantsp. 1030
Assertionsp. 1031
Wrap-Upp. 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 Topicsp. CCV
Introductionp. CCVI
Redirecting Input/Output on UNIX/Linux/Mac OS X and Windows Systemsp. CCVI
Variable-Length Argument Listsp. CCVII
Using Command-Line Argumentsp. CCIX
Notes on Compiling Multiple-Source-File Programsp. CCXI
Program Termination with exit and atexitp. CCXIII
Type Qualifier volatilep. CCXIV
Suffixes for Integer and Floating-Point Constantsp. CCXIV
Signal Handlingp. CCXV
Dynamic Memory Allocation with calloc and reallocp. CCXVII
Unconditional Branch: gotop. CCXVIII
Unionsp. CCXIX
Linkage Specificationsp. CCXXII
UML 2: Additional Diagram Typesp. CCXXIX
Introductionp. CCXXIX
Additional Diagram Typesp. CCXXIX
Using the Visual Studio Debuggerp. CCXXXI
Introductionp. CCXXXII
Breakpoints and the Continue Commandp. CCXXXII
Locals and Watch Windowsp. CCXXXVIII
Controlling Execution Using the Step Into, Step Over, Step Out and Continue Commandsp. CCXLI
Autos Windowp. CCXLIII
Wrap-Upp. CCXLIV
Using the GNU C++ Debuggerp. CCXLVII
Introductionp. CCXLVIII
Breakpoints and the run, stop, continue and print Commandsp. CCXLVIII
print and set Commandsp. CCLIV
Controlling Execution Using the step, finish and next Commandsp. CCLVI
watch Commandp. CCLIX
Wrap-Upp. CCLXI
Indexp. 1037
Table of Contents provided by Ingram. All Rights Reserved.

Rewards Program

Customer Reviews

Comprehensive book on C August 11, 2011
This series is great. It is detailed, simple and focuses on problem. For beginners as well as a reference. I started with the fourth edition and have kept them all. It came with the CD and had no missing pages or torn edges. There were no problems and I would definitely buy from this seller again.
Flag Review
Please provide a brief explanation for why you are flagging this review:
Your submission has been received. We will inspect this review as soon as possible. Thank you for your input!
C++ How to Program: 4 out of 5 stars based on 1 user reviews.

Write a Review