Chapter 1 Introduction to Computers, Programs, and C++1 1.1 Introduction2 1.2 What Is a Computer?2 1.3 Programming Languages9 1.4 Operating Systems12 1.5 History of C++13 1.6 A Simple C++ Program14 1.7 C++ Program-Development Cycle18 1.8 Programming Style and Documentation20 1.9 Programming Errors21 Chapter 2 Elementary Programming29 2.1 Introduction30 2.2 Writing a Simple Program30 2.3 Reading Input from the Keyboard32 2.4 Identifiers35 2.5 Variables35 2.6 Assignment Statements and Assignment Expressions37 2.7 Named Constants39 2.8 Numeric Data Types and Operations40 2.9 Evaluating Expressions and Operator Precedence45 2.10 Case Study: Displaying the Current Time47 2.11 Augmented Assignment Operators49 2.12 Increment and Decrement Operators50 2.13 Numeric Type Conversions52 2.14 Software Development Process55 2.15 Case Study: Counting Monetary Units59 2.16 Common Errors61 Chapter 3 Selections71 3.1 Introduction72 3.2 The bool Data Type72 3.3 if Statements73 3.4 Two-Way if-else Statements76 3.5 Nested if and Multi-Way if-else Statements77 3.6 Common Errors and Pitfalls79 3.7 Case Study: Computing Body Mass Index84 3.8 Case Study: Computing Taxes86 3.9 Generating Random Numbers89 3.10 Logical Operators91 3.11 Case Study: Determining Leap Year94 3.12 Case Study: Lottery95 3.13 switch Statements97 3.14 Conditional Expressions101 3.15 Operator Precedence and Associativity102 3.16 Debugging104 Chapter 4Mathematical Functions, Contentsxiii Characters, and Strings117 4.1Introduction118 4.2Mathematical Functions118 4.3Character Data Type and Operations122 4.4Case Study: Generating Random Characters126 4.5Case Study: Guessing Birthdays128 4.6Character Functions131 4.7Case Study: Converting a Hexadecimal Digit to a Decimal Value133 4.8The string Type134 4.9Case Study: Revising the Lottery Program Using Strings138 4.10Formatting Console Output140 4.11Simple File Input and Output144 Chapter 5Loops155 5.1Introduction156 5.2The while Loop156 5.3The do-while Loop168 5.4The for Loop171 5.5Which Loop to Use?174 5.6Nested Loops176 5.7Minimizing Numeric Errors178 5.8Case Studies179 5.9Keywords break and continue185 5.10Case Study: Checking Palindromes188 5.11Case Study: Displaying Prime Numbers190 Chapter 6Functions207 6.1Introduction208 6.2Defining a Function209 6.3Calling a Function210 6.4void Functions212 6.5Passing Arguments by Value215 6.6Modularizing Code216 6.7Overloading Functions218 6.8Function Prototypes221 6.9Default Arguments223 6.10Inline Functions224 6.11Local, Global, and Static Local Variables225 6.12Passing Arguments by Reference230 6.13Constant Reference Parameters239 6.14Case Study: Converting Hexadecimals to Decimals239 6.15Function Abstraction and Stepwise Refinement242 Chapter 7Single-Dimensional Arrays and C-Strings265 7.1Introduction266 7.2Array Basics267 7.3Problem: Lotto Numbers273 7.4Problem: Deck of Cards276 7.5Passing Arrays to Functions278 7.6Preventing Changes of Array Arguments in Functions280 7.7Returning Arrays from Functions281 7.8Problem: Counting the Occurrences of Each Letter284 7.9Searching Arrays286 7.10Sorting Arrays290 7.11C-Strings292 Chapter 8Multidimensional Arrays309 8.1Introduction310 8.2Declaring Two-Dimensional Arrays310 8.3Processing Two-Dimensional Arrays311 8.4Passing Two-Dimensional Arrays to Functions314 8.5Problem: Grading a Multiple-Choice Test315 8.6Problem: F
以下为对购买帮助不大的评价