Book description
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 Ninth 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.
MyProgrammingLabfor C++ How to Program¿ is a total learning package. MyProgrammingLab is an online homework, tutorial, and assessment program that truly engages students in learning. It helps students better prepare for class, quizzes, and exams–resulting in better performance in the course–and provides educators a dynamic set of tools for gauging individual and class progress. And, MyProgrammingLab comes from Pearson, your partner in providing the best digital learning experience.
Note: If you are purchasing the standalone text or electronic version, MyProgrammingLab does not come automatically packaged with the text. To purchase MyProgrammingLab, please visit: myprogramminglab.com or you can purchase a package of the physical text + MyProgrammingLab by searching the Pearson Higher Education web site.¿ MyProgrammingLab is not a self-paced technology and should only be purchased when required by an instructor.
View the Deitel Buzz online to learn more about the newest publications from the Deitels.
Table of contents
- Title Page
- Copyright Page
- Deitel® Series Page
- Dedication Page
- Contents
-
Preface
- C++11 Standard
- Object-Oriented Programming
- Pedagogic Features
- Other Features
- Secure C++ Programming
- Online Content
- Dependency Chart
- Teaching Approach
- Obtaining the Software Used in C++ How to Program, 9/e
- Instructor Supplements
- Online Practice and Assessment with MyProgrammingLab™
- Acknowledgments
- About the Authors
- Corporate Training from Deitel & Associates, Inc.
-
1. Introduction to Computers and C++
- 1.1. Introduction
- 1.2. Computers and the Internet in Industry and Research
- 1.3. Hardware and Software
- 1.4. Data Hierarchy
- 1.5. Machine Languages, Assembly Languages and High-Level Languages
- 1.6. C++
- 1.7. Programming Languages
- 1.8. Introduction to Object Technology
- 1.9. Typical C++ Development Environment
- 1.10. Test-Driving a C++ Application
- 1.11. Operating Systems
- 1.12. The Internet and World Wide Web
- 1.13. Some Key Software Development Terminology
- 1.14. C++11 and the Open Source Boost Libraries
- 1.15. Keeping Up to Date with Information Technologies
- 1.16. Web Resources
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
- Making a Difference
- Making a Difference Resources
-
2. Introduction to C++ Programming, Input/Output and Operators
- 2.1. Introduction
- 2.2. First Program in C++: Printing a Line of Text
- 2.3. Modifying Our First C++ Program
- 2.4. Another C++ Program: Adding Integers
- 2.5. Memory Concepts
- 2.6. Arithmetic
- 2.7. Decision Making: Equality and Relational Operators
- 2.8. Wrap-Up
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
- Making a Difference
-
3. Introduction to Classes, Objects and Strings
- 3.1. Introduction
- 3.2. Defining a Class with a Member Function
- 3.3. Defining a Member Function with a Parameter
- 3.4. Data Members, set Member Functions and get Member Functions
- 3.5. Initializing Objects with Constructors
- 3.6. Placing a Class in a Separate File for Reusability
- 3.7. Separating Interface from Implementation
- 3.8. Validating Data with set Functions
- 3.9. Wrap-Up
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
- Making a Difference
-
4. Control Statements: Part 1; Assignment, ++ and -- Operators
- 4.1. Introduction
- 4.2. Algorithms
- 4.3. Pseudocode
- 4.4. Control Structures
- 4.5. if Selection Statement
- 4.6. if...else Double-Selection Statement
- 4.7. while Repetition Statement
- 4.8. Formulating Algorithms: Counter-Controlled Repetition
- 4.9. Formulating Algorithms: Sentinel-Controlled Repetition
- 4.10. Formulating Algorithms: Nested Control Statements
- 4.11. Assignment Operators
- 4.12. Increment and Decrement Operators
- 4.13. Wrap-Up
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
- Making a Difference
-
5. Control Statements: Part 2; Logical Operators
- 5.1. Introduction
- 5.2. Essentials of Counter-Controlled Repetition
- 5.3. for Repetition Statement
- 5.4. Examples Using the for Statement
- 5.5. do...while Repetition Statement
- 5.6. switch Multiple-Selection Statement
- 5.7. break and continue Statements
- 5.8. Logical Operators
- 5.9. Confusing the Equality (==) and Assignment (=) Operators
- 5.10. Structured Programming Summary
- 5.11. Wrap-Up
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
- Making a Difference
-
6. Functions and an Introduction to Recursion
- 6.1. Introduction
- 6.2. Program Components in C++
- 6.3. Math Library Functions
- 6.4. Function Definitions with Multiple Parameters
- 6.5. Function Prototypes and Argument Coercion
- 6.6. C++ Standard Library Headers
- 6.7. Case Study: Random Number Generation
- 6.8. Case Study: Game of Chance; Introducing enum
- 6.9. C++11 Random Numbers
- 6.10. Storage Classes and Storage Duration
- 6.11. Scope Rules
- 6.12. Function Call Stack and Activation Records
- 6.13. Functions with Empty Parameter Lists
- 6.14. Inline Functions
- 6.15. References and Reference Parameters
- 6.16. Default Arguments
- 6.17. Unary Scope Resolution Operator
- 6.18. Function Overloading
- 6.19. Function Templates
- 6.20. Recursion
- 6.21. Example Using Recursion: Fibonacci Series
- 6.22. Recursion vs. Iteration
- 6.23. Wrap-Up
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
- Making a Difference
-
7. Class Templates array and vector; Catching Exceptions
- 7.1. Introduction
- 7.2. arrays
- 7.3. Declaring arrays
- 7.4. Examples Using arrays
- 7.5. Range-Based for Statement
- 7.6. Case Study: Class GradeBook Using an array to Store Grades
- 7.7. Sorting and Searching arrays
- 7.8. Multidimensional arrays
- 7.9. Case Study: Class GradeBook Using a Two-Dimensional array
- 7.10. Introduction to C++ Standard Library Class Template vector
- 7.11. Wrap-Up
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
- Recursion Exercises
- Making a Difference
-
8. Pointers
- 8.1. Introduction
- 8.2. Pointer Variable Declarations and Initialization
- 8.3. Pointer Operators
- 8.4. Pass-by-Reference with Pointers
- 8.5. Built-In Arrays
- 8.6. Using const with Pointers
- 8.7. sizeof Operator
- 8.8. Pointer Expressions and Pointer Arithmetic
- 8.9. Relationship Between Pointers and Built-In Arrays
- 8.10. Pointer-Based Strings
- 8.11. Wrap-Up
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
- Special Section: Building Your Own Computer
-
9. Classes: A Deeper Look; Throwing Exceptions
- 9.1. Introduction
- 9.2. Time Class Case Study
- 9.3. Class Scope and Accessing Class Members
- 9.4. Access Functions and Utility Functions
- 9.5. Time Class Case Study: Constructors with Default Arguments
- 9.6. Destructors
- 9.7. When Constructors and Destructors Are Called
- 9.8. Time Class Case Study: A Subtle Trap—Returning a Reference or a Pointer to a private Data Member
- 9.9. Default Memberwise Assignment
- 9.10. const Objects and const Member Functions
- 9.11. Composition: Objects as Members of Classes
- 9.12. friend Functions and friend Classes
- 9.13. Using the this Pointer
- 9.14. static Class Members
- 9.15. Wrap-Up
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
- Making a Difference
-
10. Operator Overloading; Class string
- 10.1. Introduction
- 10.2. Using the Overloaded Operators of Standard Library Class string
- 10.3. Fundamentals of Operator Overloading
- 10.4. Overloading Binary Operators
- 10.5. Overloading the Binary Stream Insertion and Stream Extraction Operators
- 10.6. Overloading Unary Operators
- 10.7. Overloading the Unary Prefix and Postfix ++ and -- Operators
- 10.8. Case Study: A Date Class
- 10.9. Dynamic Memory Management
- 10.10. Case Study: Array Class
- 10.11. Operators as Member vs. Non-Member Functions
- 10.12. Converting Between Types
- 10.13. explicit Constructors and Conversion Operators
- 10.14. Overloading the Function Call Operator ()
- 10.15. Wrap-Up
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
-
11. Object-Oriented Programming: Inheritance
- 11.1. Introduction
- 11.2. Base Classes and Derived Classes
- 11.3. Relationship between Base and Derived Classes
- 11.4. Constructors and Destructors in Derived Classes
- 11.5. public, protected and private Inheritance
- 11.6. Software Engineering with Inheritance
- 11.7. Wrap-Up
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
-
12. Object-Oriented Programming: Polymorphism
- 12.1. Introduction
- 12.2. Introduction to Polymorphism: Polymorphic Video Game
- 12.3. Relationships Among Objects in an Inheritance Hierarchy
- 12.4. Type Fields and switch Statements
- 12.5. Abstract Classes and Pure virtual Functions
- 12.6. Case Study: Payroll System Using Polymorphism
- 12.7. (Optional) Polymorphism, Virtual Functions and Dynamic Binding “Under the Hood”
- 12.8. Case Study: Payroll System Using Polymorphism and Runtime Type Information with Downcasting, dynamic_cast, typeid and type_info
- 12.9. Wrap-Up
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
- Making a Difference
-
13. Stream Input/Output: A Deeper Look
- 13.1. Introduction
- 13.2. Streams
- 13.3. Stream Output
- 13.4. Stream Input
- 13.5. Unformatted I/O Using read, write and gcount
- 13.6. Introduction to Stream Manipulators
- 13.7. Stream Format States and Stream Manipulators
- 13.8. Stream Error States
- 13.9. Tying an Output Stream to an Input Stream
- 13.10. Wrap-Up
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
-
14. File Processing
- 14.1. Introduction
- 14.2. Files and Streams
- 14.3. Creating a Sequential File
- 14.4. Reading Data from a Sequential File
- 14.5. Updating Sequential Files
- 14.6. Random-Access Files
- 14.7. Creating a Random-Access File
- 14.8. Writing Data Randomly to a Random-Access File
- 14.9. Reading from a Random-Access File Sequentially
- 14.10. Case Study: A Transaction-Processing Program
- 14.11. Object Serialization
- 14.12. Wrap-Up
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
- Making a Difference
-
15. Standard Library Containers and Iterators
- 15.1. Introduction
- 15.2. Introduction to Containers
- 15.3. Introduction to Iterators
- 15.4. Introduction to Algorithms
- 15.5. Sequence Containers
- 15.6. Associative Containers
- 15.7. Container Adapters
- 15.8. Class bitset
- 15.9. Wrap-Up
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
- Recommended Reading
- 16. Standard Library Algorithms
-
17. Exception Handling: A Deeper Look
- 17.1. Introduction
- 17.2. Example: Handling an Attempt to Divide by Zero
- 17.3. Rethrowing an Exception
- 17.4. Stack Unwinding
- 17.5. When to Use Exception Handling
- 17.6. Constructors, Destructors and Exception Handling
- 17.7. Exceptions and Inheritance
- 17.8. Processing new Failures
- 17.9. Class unique_ptr and Dynamic Memory Allocation
- 17.10. Standard Library Exception Hierarchy
- 17.11. Wrap-Up
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
-
18. Introduction to Custom Templates
- 18.1. Introduction
- 18.2. Class Templates
- 18.3. Function Template to Manipulate a Class-Template Specialization Object
- 18.4. Nontype Parameters
- 18.5. Default Arguments for Template Type Parameters
- 18.6. Overloading Function Templates
- 18.7. Wrap-Up
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
- 19. Custom Templatized Data Structures
- 20. Searching and Sorting
-
21. Class string and String Stream Processing: A Deeper Look
- 21.1. Introduction
- 21.2. string Assignment and Concatenation
- 21.3. Comparing strings
- 21.4. Substrings
- 21.5. Swapping strings
- 21.6. string Characteristics
- 21.7. Finding Substrings and Characters in a string
- 21.8. Replacing Characters in a string
- 21.9. Inserting Characters into a string
- 21.10. Conversion to Pointer-Based char * Strings
- 21.11. Iterators
- 21.12. String Stream Processing
- 21.13. C++11 Numeric Conversion Functions
- 21.14. Wrap-Up
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
- Making a Difference
-
22. Bits, Characters, C Strings and structs
- 22.1. Introduction
- 22.2. Structure Definitions
- 22.3. typedef
- 22.4. Example: Card Shuffling and Dealing Simulation
- 22.5. Bitwise Operators
- 22.6. Bit Fields
- 22.7. Character-Handling Library
- 22.8. C String-Manipulation Functions
- 22.9. C String-Conversion Functions
- 22.10. Search Functions of the C String-Handling Library
- 22.11. Memory Functions of the C String-Handling Library
- 22.12. Wrap-Up
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
- Special Section: Advanced String-Manipulation Exercises
- Challenging String-Manipulation Projects
-
23. Other Topics
- 23.1. Introduction
- 23.2. const_cast Operator
- 23.3. mutable Class Members
- 23.4. namespaces
- 23.5. Operator Keywords
- 23.6. Pointers to Class Members (.* and ->*)
- 23.7. Multiple Inheritance
- 23.8. Multiple Inheritance and virtual Base Classes
- 23.9. Wrap-Up
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
-
24. C++11: Additional Features
- 24.1 Introduction
- 24.2 Smart Pointers
- 24.3 Multithreading
- 24.4 noexcept Exception Specifications and the noexcept Operator
- 24.5 Move Semantics
- 24.6 static_assert
- 24.7 decltype
- 24.8 constexpr
- 24.9 Defaulted Special Member Functions
- 24.10 Variadic Templates
- 24.11 tuples
- 24.12 initializer_list Class Template
- 24.13 Inherited Constructors with Multiple Inheritance
- 24.14 Regular Expressions with the regex Library
- 24.15 Raw String Literals
- 24.16 Wrap-Up
-
25. ATM Case Study, Part 1: Object-Oriented Design with the UML
- 25.1 Introduction
- 25.2 Introduction to Object-Oriented Analysis and Design
- 25.3 Examining the ATM Requirements Document
- 25.4 Identifying the Classes in the ATM Requirements Document
- 25.5 Identifying Class Attributes
- 25.6 Identifying Objects’ States and Activities
- 25.7 Identifying Class Operations
- 25.8 Indicating Collaboration Among Objects
- 25.9 Wrap-Up
- 26. ATM Case Study, Part 2: Implementing an ObjectOriented Design
- Chapters on the Web
- A. Operator Precedence and Associativity
- B. ASCII Character Set
- C. Fundamental Types
-
D. Number Systems
- D.1. Introduction
- D.2. Abbreviating Binary Numbers as Octal and Hexadecimal Numbers
- D.3. Converting Octal and Hexadecimal Numbers to Binary Numbers
- D.4. Converting from Binary, Octal or Hexadecimal to Decimal
- D.5. Converting from Decimal to Binary, Octal or Hexadecimal
- D.6. Negative Binary Numbers: Two’s Complement Notation
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
-
E. Preprocessor
- E.1. Introduction
- E.2. #include Preprocessing Directive
- E.3. #define Preprocessing Directive: Symbolic Constants
- E.4. #define Preprocessing Directive: Macros
- E.5. Conditional Compilation
- E.6. #error and #pragma Preprocessing Directives
- E.7. Operators # and ##
- E.8. Predefined Symbolic Constants
- E.9. Assertions
- E.10. Wrap-Up
- Summary
- Self-Review Exercises
- Answers to Self-Review Exercises
- Exercises
-
F. C Legacy Code Topics
- F.1 Introduction
- F.2 Redirecting Input/Output on UNIX/Linux/Mac OS X and Windows Systems
- F.3 Variable-Length Argument Lists
- F.4 Using Command-Line Arguments
- F.5 Notes on Compiling Multiple-Source-File Programs
- F.6 Program Termination with exit and atexit
- F.7 Type Qualifier volatile
- F.8 Suffixes for Integer and Floating-Point Constants
- F.9 Signal Handling
- F.10 Dynamic Memory Allocation with calloc and realloc
- F.11 Unconditional Branch: goto
- F.12 Unions
- F.13 Linkage Specifications
- F.14 Wrap-Up
- G. UML 2: Additional Diagram Types
- H. Using the Visual Studio Debugger
- I. Using the GNU C++ Debugger
- J. Using the Xcode® Debugger
- K. Test Driving a C++ Program on OS X
- Index
Product information
- Title: C++ How to Program, Ninth Edition
- Author(s):
- Release date: February 2013
- Publisher(s): Pearson
- ISBN: 9780133378795
You might also like
book
C++ How to Program, Sixth Edition
For Introduction to Programming (CS1) and other more intermediate courses covering programming in C++. Also appropriate …
book
C++ How to Program, 10/e
C++ How to Program presents leading-edge computing technologies in a friendly manner appropriate for introductory college …
book
Programming: Principles and Practice Using C++, 2nd Edition
An Introduction to Programming by the Inventor of C++ Preparation for Programming in the Real World …
book
Effective C++, Third Edition
“Every C++ professional needs a copy of Effective C++. It is an absolute must-read for anyone …