Home > Store

C++ How to Program, 7th Edition

Register your product to gain access to bonus material or receive a coupon.

C++ How to Program, 7th Edition


  • Sorry, this book is no longer in print.
Not for Sale



  • Full-color program listings include highlighting of the new features presented and syntax coloring of code to help readers better interpret the code.
  • Signature “Live Code™ Approach” — Language features are presented in the context of complete working programs.
    — Features thousands of lines of code in hundreds of complete working programs.
    — Enables students to confirm that programs run as expected.
    — Students can also manipulate the code from the book's Companion Web site or from the author's Web site.
  • Outstanding, consistent and applied pedagogy provides hundreds of valuable programming tips and facilitates learning.
    — Icons throughout the text identify hundreds of Software Engineering Observations; Good Programming Practices; Common Programming Errors; Portability Tips; Performance Tips, Testing and Debugging Tips, and Look-and-Feel Observations.
  • Early classes and early objects approach.
  • Optional automated teller machine (ATM) case study teaches the fundamentals of software engineering and object-oriented design with the UMLTM 2.0
  • Integrated case studies throughout the book including the Time class (Chapter 9); the Employee class (Chapter 12 and 13) and the GradeBook class (Chapters 3-7)
  • Uses string and vector classes to make earlier examples more object-oriented
  • CD-ROM in every text includes Microsoft Visual Studio Express Edition
  • An access code to the Companion Website is available free when packaged with a new text. The Companion Website includes VideoNotes of all the code examples in Chapters 2-13 and select examples in 16-17, solutions to about half of the exercises in the book, additional true/false assessment questions (with answers) and a lab manual.


  • Copyright 2010
  • Edition: 7th
  • Book
  • ISBN-10: 0-13-611726-0
  • ISBN-13: 978-0-13-611726-1

For Introduction to Programming (CS1) and other more intermediate courses covering programming in C++. Also appropriate as a supplement for upper-level courses where the instructor uses a book as a reference for the C++ language.

This best-selling comprehensive text is aimed at readers with little or no programming experience. It teaches programming 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. The Seventh Edition encourages students to connect computers to the community, using the Internet to solve problems and make a difference in our world. All content has been carefully fine-tuned in response to a team of distinguished academic and industry reviewers.

Sample Content

Table of Contents

Chapters 23—27 and Appendices F—I are PDF documents posted online at the book’s Companion Website (located at www.pearsonhighered.com/deitel).
Preface xxiii
1 Introduction to Computers, the Internet and the World Wide Web 1
1.1 Introduction 2
1.2 Computers: Hardware and Software 3
1.3 Computer Organization 4
1.4 Personal, Distributed and Client/Server Computing 5
1.5 The Internet and the World Wide Web 6
1.6 Web 2.0 6
1.7 Machine Languages, Assembly Languages and High-Level Languages 7
1.8 History of C and C++ 8
1.9 C++ Standard Library 9
1.10 History of Java 10
1.11 Fortran, COBOL, Pascal and Ada 11
1.12 BASIC, Visual Basic, Visual C++, C# and .NET 11
1.13 Key Software Trend: Object Technology 12
1.14 Typical C++ Development Environment 13
1.15 Notes About C++ and C++ How to Program, 7/e 15
1.16 Test-Driving a C++ Application 16
1.17 Software Technologies 22
1.18 Future of C++: Open Source Boost Libraries, TR1 and C++0x 23
1.19 Software Engineering Case Study: Introduction to Object Technology and the UML 24
1.20 Wrap-Up 28
1.21 Web Resources 29

2 Introduction to C++ Programming 39
2.1 Introduction 40
2.2 First Program in C++: Printing a Line of Text 40
2.3 Modifying Our First C++ Program 44
2.4 Another C++ Program: Adding Integers 45
2.5 Memory Concepts 49
2.6 Arithmetic 50
2.7 Decision Making: Equality and Relational Operators 54
2.8 Wrap-Up 58

3 Introduction to Classes and Objects 68
3.1 Introduction 69
3.2 Classes, Objects, Member Functions and Data Members 69
3.3 Defining a Class with a Member Function 71
3.4 Defining a Member Function with a Parameter 74
3.5 Data Members, set Functions and get Functions 77
3.6 Initializing Objects with Constructors 84
3.7 Placing a Class in a Separate File for Reusability 87
3.8 Separating Interface from Implementation 91
3.9 Validating Data with set Functions 97
3.10 Wrap-Up 102

4 Control Statements: Part 1 109
4.1 Introduction 110
4.2 Algorithms 110
4.3 Pseudocode 111
4.4 Control Structures 112
4.5 if Selection Statement 115
4.6 if…else Double-Selection Statement 117
4.7 while Repetition Statement 122
4.8 Formulating Algorithms: Counter-Controlled Repetition 123
4.9 Formulating Algorithms: Sentinel-Controlled Repetition 129
4.10 Formulating Algorithms: Nested Control Statements 139
4.11 Assignment Operators 144
4.12 Increment and Decrement Operators 144
4.13 Wrap-Up 148

5 Control Statements: Part 2 163
5.1 Introduction 164
5.2 Essentials of Counter-Controlled Repetition 164
5.3 for Repetition Statement 166
5.4 Examples Using the for Statement 170
5.5 do…while Repetition Statement 174
5.6 switch Multiple-Selection Statement 176
5.7 break and continue Statements 185
5.8 Logical Operators 187
5.9 Confusing the Equality (==) and Assignment (=) Operators 191
5.10 Structured Programming Summary 192
5.11 Wrap-Up 197

6 Functions and an Introduction to Recursion 207
6.1 Introduction 208
6.2 Program Components in C++ 209
6.3 Math Library Functions 210
6.4 Function Definitions with Multiple Parameters 211
6.5 Function Prototypes and Argument Coercion 216
6.6 C++ Standard Library Header Files 218
6.7 Case Study: Random Number Generation 220
6.8 Case Study: Game of Chance; Introducing enum 225
6.9 Storage Classes 229
6.10 Scope Rules 231
6.11 Function Call Stack and Activation Records 235
6.12 Functions with Empty Parameter Lists 238
6.13 Inline Functions 239
6.14 References and Reference Parameters 241
6.15 Default Arguments 245
6.16 Unary Scope Resolution Operator 247
6.17 Function Overloading 248
6.18 Function Templates 251
6.19 Recursion 253
6.20 Example Using Recursion: Fibonacci Series 256
6.21 Recursion vs. Iteration 259
6.22 Wrap-Up 262

7 Arrays and Vectors 282
7.1 Introduction 283
7.2 Arrays 284
7.3 Declaring Arrays 285
7.4 Examples Using Arrays 286
7.4.1 Declaring an Array and Using a Loop to Initialize the Array’s Elements 286
7.4.2 Initializing an Array in a Declaration with an Initializer List 287
7.4.3 Specifying an Array’s Size with a Constant Variable and Setting Array Elements with Calculations 288
7.4.4 Summing the Elements of an Array 291
7.4.5 Using Bar Charts to Display Array Data Graphically 291
7.4.6 Using the Elements of an Array as Counters 293
7.4.7 Using Arrays to Summarize Survey Results 294
7.4.8 Static Local Arrays and Automatic Local Arrays 297
7.5 Passing Arrays to Functions 299
7.6 Case Study: Class GradeBook Using an Array to Store Grades 303
7.7 Searching Arrays with Linear Search 309
7.8 Sorting Arrays with Insertion Sort 311
7.9 Multidimensional Arrays 313
7.10 Case Study: Class GradeBook Using a Two-Dimensional Array 316
7.11 Introduction to C++ Standard Library Class Template vector 323
7.12 Wrap-Up 328

8 Pointers 345
8.1 Introduction 346
8.2 Pointer Variable Declarations and Initialization 346
8.3 Pointer Operators 348
8.4 Pass-by-Reference with Pointers 350
8.5 Using const with Pointers 354
8.6 Selection Sort Using Pass-by-Reference 358
8.7 sizeof Operator 362
8.8 Pointer Expressions and Pointer Arithmetic 365
8.9 Relationship Between Pointers and Arrays 367
8.10 Pointer-Based String Processing 370
8.11 Arrays of Pointers 373
8.12 Function Pointers 374
8.13 Wrap-Up 377

9 Classes: A Deeper Look, Part 1 395
9.1 Introduction 396
9.2 Time Class Case Study 397
9.3 Class Scope and Accessing Class Members 403
9.4 Separating Interface from Implementation 405
9.5 Access Functions and Utility Functions 406
9.6 Time Class Case Study: Constructors with Default Arguments 409
9.7 Destructors 414
9.8 When Constructors and Destructors Are Called 415
9.9 Time Class Case Study: A Subtle Trap–Returning a Reference to a private Data Member 418
9.10 Default Memberwise Assignment 421
9.11 Wrap-Up 423

10 Classes: A Deeper Look, Part 2 429
10.1 Introduction 430
10.2 const (Constant) Objects and const Member Functions 430
10.3 Composition: Objects as Members of Classes 439
10.4 friend Functions and friend Classes 445
10.5 Using the this Pointer 448
10.6 static Class Members 453
10.7 Data Abstraction and Information Hiding 458
10.8 Wrap-Up 460

11 Operator Overloading 466
11.1 Introduction 467
11.2 Fundamentals of Operator Overloading 468
11.3 Restrictions on Operator Overloading 469
11.4 Operator Functions as Class Members vs. Global Functions 470
11.5 Overloading Stream Insertion and Stream Extraction Operators 472
11.6 Overloading Unary Operators 475
11.7 Overloading Binary Operators 476
11.8 Dynamic Memory Management 476
11.9 Case Study: Array Class 478
11.10 Converting between Types 490
11.11 Building a String Class 491
11.12 Overloading ++ and -- 492
11.13 Case Study: A Date Class 494
11.14 Standard Library Class string 498
11.15 explicit Constructors 502
11.16 Proxy Classes 505
11.17 Wrap-Up 509

12 Object-Oriented Programming: Inheritance 521
12.1 Introduction 522
12.2 Base Classes and Derived Classes 523
12.3 protected Members 526
12.4 Relationship between Base Classes and Derived Classes 526
12.4.1 Creating and Using a CommissionEmployee Class 527
12.4.2 Creating a BasePlusCommissionEmployee Class Without Using Inheritance 532
12.4.3 Creating a CommissionEmployee—BasePlusCommissionEmployee Inheritance Hierarchy 537
12.4.4 CommissionEmployee—BasePlusCommissionEmployee Inheritance Hierarchy Using protected Data 542
12.4.5 CommissionEmployee—BasePlusCommissionEmployee Inheritance Hierarchy Using private Data 549
12.5 Constructors and Destructors in Derived Classes 556
12.6 public, protected and private Inheritance 564
12.7 Software Engineering with Inheritance 565
12.8 Wrap-Up 566

13 Object-Oriented Programming: Polymorphism 572
13.1 Introduction 573
13.2 Polymorphism Examples 574
13.3 Relationships Among Objects in an Inheritance Hierarchy 575
13.3.1 Invoking Base-Class Functions from Derived-Class Objects 576
13.3.2 Aiming Derived-Class Pointers at Base-Class Objects 583
13.3.3 Derived-Class Member-Function Calls via Base-Class Pointers 584
13.3.4 Virtual Functions 586
13.3.5 Summary of the Allowed Assignments Between Base-Class and Derived-Class Objects and Pointers 592
13.4 Type Fields and switch Statements 593
13.5 Abstract Classes and Pure virtual Functions 593
13.6 Case Study: Payroll System Using Polymorphism 595
13.6.1 Creating Abstract Base Class Employee 597
13.6.2 Creating Concrete Derived Class SalariedEmployee 600
13.6.3 Creating Concrete Derived Class HourlyEmployee 602
13.6.4 Creating Concrete Derived Class CommissionEmployee 605
13.6.5 Creating Indirect Concrete Derived Class BasePlusCommissionEmployee 607
13.6.6 Demonstrating Polymorphic Processing 608
13.7 (Optional) Polymorphism, Virtual Functions and Dynamic Binding “Under the Hood” 612
13.8 Case Study: Payroll System Using Polymorphism and Runtime Type Information with Downcasting, dynamic_cast, typeid and type_info 616
13.9 Virtual Destructors 620
13.10 Wrap-Up 620

14 Templates 626
14.1 Introduction 627
14.2 Function Templates 628
14.3 Overloading Function Templates 631
14.4 Class Templates 631
14.5 Nontype Parameters and Default Types for Class Templates 638
14.6 Notes on Templates and Inheritance 639
14.7 Notes on Templates and Friends 639
14.8 Notes on Templates and static Members 640
14.9 Wrap-Up 640

15 Stream Input/Output 645
15.1 Introduction 646
15.2 Streams 647
15.2.1 Classic Streams vs. Standard Streams 647
15.2.2 iostream Library Header Files 648
15.2.3 Stream Input/Output Classes and Objects 648
15.3 Stream Output 651
15.3.1 Output of char * Variables 651
15.3.2 Character Output Using Member Function put 651
15.4 Stream Input 652
15.4.1 get and getline Member Functions 652
15.4.2 istream Member Functions peek, putback and ignore 655
15.4.3 Type-Safe I/O 655
15.5 Unformatted I/O Using read, write and gcount 655
15.6 Introduction to Stream Manipulators 656
15.6.1 Integral Stream Base: dec, oct, hex and setbase 657
15.6.2 Floating-Point Precision (precision, setprecision) 658
15.6.3 Field Width (width, setw) 659
15.6.4 User-Defined Output Stream Manipulators 660
15.7 Stream Format States and Stream Manipulators 662
15.7.1 Trailing Zeros and Decimal Points (showpoint) 662
15.7.2 Justification (left, right and internal) 663
15.7.3 Padding (fill, setfill) 665
15.7.4 Integral Stream Base (dec, oct, hex, showbase) 666
15.7.5 Floating-Point Numbers; Scientific and Fixed Notation (scientific, fixed) 667
15.7.6 Uppercase/Lowercase Control (uppercase) 668
15.7.7 Specifying Boolean Format (boolalpha) 668
15.7.8 Setting and Resetting the Format State via Member Function flags 669
15.8 Stream Error States 671
15.9 Tying an Output Stream to an Input Stream 673
15.10 Wrap-Up 673

16 Exception Handling 683
16.1 Introduction 684
16.2 Exception-Handling Overview 685
16.3 Example: Handling an Attempt to Divide by Zero 685
16.4 When to Use Exception Handling 691
16.5 Rethrowing an Exception 692
16.6 Exception Specifications 694
16.7 Processing Unexpected Exceptions 695
16.8 Stack Unwinding 695
16.9 Constructors, Destructors and Exception Handling 697
16.10 Exceptions and Inheritance 698
16.11 Processing new Failures 698
16.12 Class auto_ptr and Dynamic Memory Allocation 701
16.13 Standard Library Exception Hierarchy 703
16.14 Other Error-Handling Techniques 705
16.15 Wrap-Up 706

17 File Processing 713
17.1 Introduction 714
17.2 Data Hierarchy 714
17.3 Files and Streams 716
17.4 Creating a Sequential File 717
17.5 Reading Data from a Sequential File 721
17.6 Updating Sequential Files 726
17.7 Random-Access Files 727
17.8 Creating a Random-Access File 728
17.9 Writing Data Randomly to a Random-Access File 733
17.10 Reading from a Random-Access File Sequentially 735
17.11 Case Study: A Transaction-Processing Program 737
17.12 Overview of Object Serialization 743
17.13 Wrap-Up 744

18 Class string and String Stream Processing 755
18.1 Introduction 756
18.2 string Assignment and Concatenation 757
18.3 Comparing strings 759
18.4 Substrings 762
18.5 Swapping strings 762
18.6 string Characteristics 763
18.7 Finding Substrings and Characters in a string 766
18.8 Replacing Characters in a string 768
18.9 Inserting Characters into a string 769
18.10 Conversion to C-Style Pointer-Based char * Strings 770
18.11 Iterators 772
18.12 String Stream Processing 773
18.13 Wrap-Up 776

19 Searching and Sorting 784
19.1 Introduction 785
19.2 Searching Algorithms 786
19.2.1 Efficiency of Linear Search 786
19.2.2 Binary Search 788
19.3 Sorting Algorithms 793
19.3.1 Efficiency of Selection Sort 793
19.3.2 Efficiency of Insertion Sort 793
19.3.3 Merge Sort (A Recursive Implementation) 794
19.4 Wrap-Up 801

20 Data Structures 806
20.1 Introduction 807
20.2 Self-Referential Classes 808
20.3 Dynamic Memory Allocation and Data Structures 809
20.4 Linked Lists 809
20.5 Stacks 824
20.6 Queues 829
20.7 Trees 832
20.8 Wrap-Up 841

21 Bits, Characters, C Strings and structs 852
21.1 Introduction 853
21.2 Structure Definitions 853
21.3 Initializing Structures 856
21.4 Using Structures with Functions 856
21.5 typedef 856
21.6 Example: Card Shuffling and Dealing Simulation 857
21.7 Bitwise Operators 860
21.8 Bit Fields 869
21.9 Character-Handling Library 873
21.10 Pointer-Based String Manipulation Functions 878
21.11 Pointer-Based String-Conversion Functions 885
21.12 Search Functions of the Pointer-Based String-Handling Library 890
21.13 Memory Functions of the Pointer-Based String-Handling Library 895
21.14 Wrap-Up 899

22 Standard Template Library (STL) 916
22.1 Introduction to the Standard Template Library (STL) 917
22.1.1 Introduction to Containers 919
22.1.2 Introduction to Iterators 923
22.1.3 Introduction to Algorithms 928
22.2 Sequence Containers 930
22.2.1 vector Sequence Container 930
22.2.2 list Sequence Container 938
22.2.3 deque Sequence Container 942
22.3 Associative Containers 944
22.3.1 multiset Associative Container 944
22.3.2 set Associative Container 947
22.3.3 multimap Associative Container 948
22.3.4 map Associative Container 950
22.4 Container Adapters 952
22.4.1 stack Adapter 952
22.4.2 queue Adapter 954
22.4.3 priority_queue Adapter 955
22.5 Algorithms 957
22.5.1 fill, fill_n, generate and generate_n 958
22.5.2 equal, mismatch and lexicographical_compare 959
22.5.3 remove, remove_if, remove_copy and remove_copy_if 962
22.5.4 replace, replace_if, replace_copy and replace_copy_if 964
22.5.5 Mathematical Algorithms 967
22.5.6 Basic Searching and Sorting Algorithms 970
22.5.7 swap, iter_swap and swap_ranges 972
22.5.8 copy_backward, merge, unique and reverse 973
22.5.9 inplace_merge, unique_copy and reverse_copy 976
22.5.10 Set Operations 977
22.5.11 lower_bound, upper_bound and equal_range 980
22.5.12 Heapsort 982
22.5.13 min and max 985
22.5.14 STL Algorithms Not Covered in This Chapter 986
22.6 Class bitset 987
22.7 Function Objects 991
22.8 Wrap-Up 994
22.9 STL Web Resources 995

Chapters on the Web 1005
Chapters 23—27 are PDF documents posted online at the book’s Companion Website (located at www.pearsonhighered.com/deitel).

23 Boost Libraries, Technical Report 1 and C++0x I
23.1 Introduction II
23.2 Deitel Online C++ and Related Resource Centers II
23.3 Boost Libraries II
23.4 Boost Libraries Overview III
23.5 Regular Expressions with the Boost.Regex Library VI
23.5.1 Regular Expression Example VI
23.5.2 Validating User Input with Regular Expressions IX
23.5.3 Replacing and Splitting Strings XII
23.6 Smart Pointers with Boost.Smart_ptr XIV
23.6.1 Reference Counted shared_ptr XIV
23.6.2 weak_ptr: shared_ptr Observer XIX
23.7 Technical Report 1 XXIV
23.8 C++0x XXVI
23.9 Core Language Changes XXVI
23.10 Wrap-Up XXXI

24 Other Topics XL
24.1 Introduction XLI
24.2 const_cast Operator XLI
24.3 mutable Class Members XLIII
24.4 namespaces XLV
24.5 Operator Keywords XLVIII
24.6 Pointers to Class Members (.* and ->*) L
24.7 Multiple Inheritance LII
24.8 Multiple Inheritance and virtual Base Classes LVII
24.9 Wrap-Up LXII

25 ATM Case Study, Part 1: Object-Oriented Design with the UML LXVII
25.1 Introduction LXVIII
25.2 Examining the ATM Requirements Document LXVIII
25.3 Identifying the Classes in the ATM Requirements Document LXXVI
25.4 Identifying Class Attributes LXXXIII
25.5 Identifying Objects’ States and Activities LXXXVII
25.6 Identifying Class Operations XCI
25.7 Indicating Collaboration Among Objects XCVIII
25.8 Wrap-Up CV

26 ATM Case Study, Part 2: Implementing an Object-Oriented Design CIX
26.1 Introduction CX
26.2 Starting to Program the Classes of the ATM System CX
26.3 Incorporating Inheritance into the ATM System CXVII
26.4 ATM Case Study Implementation CXXIV
26.4.1 Class ATM CXXIV
26.4.2 Class Screen CXXXII
26.4.3 Class Keypad CXXXIII
26.4.4 Class CashDispenser CXXXIV
26.4.5 Class DepositSlot CXXXVI
26.4.6 Class Account CXXXVII
26.4.7 Class BankDatabase CXXXIX
26.4.8 Class Transaction CXLIII
26.4.9 Class BalanceInquiry CXLV
26.4.10 Class Withdrawal CXLVII
26.4.11 Class Deposit CLII
26.4.12 Test Program ATMCaseStudy.cpp CLV
26.5 Wrap-Up CLV

27 Game Programming with Ogre CLVIII
27.1 Introduction CLIX
27.2 Installing Ogre, OgreAL and OpenAL CLIX
27.3 Basics of Game Programming CLIX
27.4 The Game of Pong: Code Walkthrough CLXII
27.4.1 Ogre Initialization CLXIII
27.4.2 Creating a Scene CLXXII
27.4.3 Adding to the Scene CLXXIII
27.4.4 Animation and Timers CLXXXV
27.4.5 User Input CLXXXVI
27.4.6 Collision Detection CLXXXVIII
27.4.7 Sound CXCII
27.4.8 Resources CXCIII
27.4.9 Pong Driver CXCIV
27.5 Wrap-Up CXCV
27.6 Ogre Web Resources CXCV

A Operator Precedence and Associativity 1006
B ASCII Character Set 1008
C Fundamental Types 1009
D Number Systems 1011
D.1 Introduction 1012
D.2 Abbreviating Binary Numbers as Octal and Hexadecimal Numbers 1015
D.3 Converting Octal and Hexadecimal Numbers to Binary Numbers 1016
D.4 Converting from Binary, Octal or Hexadecimal to Decimal 1016
D.5 Converting from Decimal to Binary, Octal or Hexadecimal 1017
D.6 Negative Binary Numbers: Two’s Complement Notation 1019
E Preprocessor 1024
E.1 Introduction 1025
E.2 #include Preprocessor Directive 1025
E.3 #define Preprocessor Directive: Symbolic Constants 1026
E.4 #define Preprocessor Directive: Macros 1026
E.5 Conditional Compilation 1028
E.6 #error and #pragma Preprocessor Directives 1029
E.7 Operators # and ## 1030
E.8 Predefined Symbolic Constants 1030
E.9 Assertions 1031
E.10 Wrap-Up 1031

Appendices on the Web 1036
Appendices F—I are PDF documents posted online at the book’s Companion Website (located at www.pearsonhighered.com/deitel).
F C Legacy Code Topics CCV
F.1 Introduction CCVI
F.2 Redirecting Input/Output on UNIX/Linux/Mac OS X and Windows Systems CCVI
F.3 Variable-Length Argument Lists CCVII
F.4 Using Command-Line Arguments CCIX
F.5 Notes on Compiling Multiple-Source-File Programs CCXI
F.6 Program Termination with exit and atexit CCXIII
F.7 Type Qualifier volatile CCXIV
F.8 Suffixes for Integer and Floating-Point Constants CCXIV
F.9 Signal Handling CCXV
F.10 Dynamic Memory Allocation with calloc and realloc CCXVII
F.11 Unconditional Branch: goto CCXVIII
F.12 Unions CCXIX
F.13 Linkage Specifications CCXXII
F.14 Wrap-Up CCXXIII
G UML 2: Additional Diagram Types CCXXIX
G.1 Introduction CCXXIX
G.2 Additional Diagram Types CCXXIX
H Using the Visual Studio Debugger CCXXXI
H.1 Introduction CCXXXII
H.2 Breakpoints and the Continue Command CCXXXII
H.3 Locals and Watch Windows CCXXXVIII
H.4 Controlling Execution Using the Step Into, Step Over, Step Out and Continue Commands CCXLI
H.5 Autos Window CCXLIII
H.6 Wrap-Up CCXLIV
I Using the GNU C++ Debugger CCXLVII
I.1 Introduction CCXLVIII
I.2 Breakpoints and the run, stop, continue and print Commands CCXLVIII
I.3 print and set Commands CCLIV
I.4 Controlling Execution Using the step, finish and next Commands CCLVI
I.5 watch Command CCLIX
I.6 Wrap-Up CCLXI
Index 1037


Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020