|
![]() |
|||
|
||||
OverviewFor 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. View the Deitel Buzz online to learn more about the newest publications from the Deitels. NEW! This edition is available with MyProgrammingLab, an innovative online homework and assessment tool. Through the power of practice and immediate personalized feedback, MyProgrammingLab helps students fully grasp the logic, semantics, and syntax of programming. 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. Full Product DetailsAuthor: Harvey Deitel , Paul DeitelPublisher: Pearson Education Limited Imprint: Pearson Education Limited Edition: 9th edition Dimensions: Width: 17.90cm , Height: 3.80cm , Length: 23.40cm Weight: 1.496kg ISBN: 9780273793298ISBN 10: 0273793292 Pages: 1064 Publication Date: 09 May 2013 Audience: College/higher education , Tertiary & Higher Education Replaced By: 9781292153346 Format: Mixed media product Publisher's Status: Active Availability: In Print ![]() This item will be ordered in for you from one of our suppliers. Upon receipt, we will promptly dispatch it out to you. For in store availability, please contact us. Table of ContentsChapters 24-26 and Appendices F-K are PDF documents posted online at the book's Companion Website, which is accessible from www.pearsonhighered.com/deitel Preface xxi1 Introduction to Computers and C++ 11.1 Introduction 21.2 Computers and the Internet in Industry and Research 21.3 Hardware and Software 51.3.1 Moore's Law 61.3.2 Computer Organization 61.4 Data Hierarchy 71.5 Machine Languages, Assembly Languages and High-Level Languages 91.6 C++ 101.7 Programming Languages 111.8 Introduction to Object Technology 141.9 Typical C++ Development Environment 171.10 Test-Driving a C++ Application 191.11 Operating Systems 251.11.1 Windows-A Proprietary Operating System 251.11.2 Linux-An Open-Source Operating System 261.11.3 Apple's OS X; Apple's iOS for iPhone (R), iPad (R) and iPod Touch (R) Devices 261.11.4 Google's Android 271.12 The Internet and World Wide Web 271.13 Some Key Software Development Terminology 291.14 C++11 and the Open Source Boost Libraries 311.15 Keeping Up to Date with Information Technologies 321.16 Web Resources 33 2 Introduction to C++ Programming; Input/Output and Operators 382.1 Introduction 392.2 First Program in C++: Printing a Line of Text 392.3 Modifying Our First C++ Program 432.4 Another C++ Program: Adding Integers 442.5 Memory Concepts 482.6 Arithmetic 492.7 Decision Making: Equality and Relational Operators 532.8 Wrap-Up 57 3 Introduction to Classes, Objects and Strings 663.1 Introduction 673.2 Defining a Class with a Member Function 673.3 Defining a Member Function with a Parameter 703.4 Data Members, set Member Functions and get Member Functions 743.5 Initializing Objects with Constructors 793.6 Placing a Class in a Separate File for Reusability 833.7 Separating Interface from Implementation 873.8 Validating Data with set Functions 923.9 Wrap-Up 97 4 Control Statements: Part 1; Assignment, ++ and -- Operators 1044.1 Introduction 1054.2 Algorithms 1054.3 Pseudocode 1064.4 Control Structures 1074.5 if Selection Statement 1104.6 if...else Double-Selection Statement 1124.7 while Repetition Statement 1164.8 Formulating Algorithms: Counter-Controlled Repetition 1184.9 Formulating Algorithms: Sentinel-Controlled Repetition 1244.10 Formulating Algorithms: Nested Control Statements 1344.11 Assignment Operators 1394.12 Increment and Decrement Operators 1404.13 Wrap-Up 143 5 Control Statements: Part 2; Logical Operators 1575.1 Introduction 1585.2 Essentials of Counter-Controlled Repetition 1585.3 for Repetition Statement 1595.4 Examples Using the for Statement 1635.5 do...while Repetition Statement 1685.6 switch Multiple-Selection Statement 1695.7 break and continue Statements 1785.8 Logical Operators 1805.9 Confusing the Equality (==) and Assignment (=) Operators 1855.10 Structured Programming Summary 1865.11 Wrap-Up 191 6 Functions and an Introduction to Recursion 2016.1 Introduction 2026.2 Program Components in C++ 2036.3 Math Library Functions 2046.4 Function Definitions with Multiple Parameters 2056.5 Function Prototypes and Argument Coercion 2106.6 C++ Standard Library Headers 2126.7 Case Study: Random Number Generation 2146.8 Case Study: Game of Chance; Introducing enum 2196.9 C++11 Random Numbers 2246.10 Storage Classes and Storage Duration 2256.11 Scope Rules 2286.12 Function Call Stack and Activation Records 2316.13 Functions with Empty Parameter Lists 2356.14 Inline Functions 2366.15 References and Reference Parameters 2376.16 Default Arguments 2406.17 Unary Scope Resolution Operator 2426.18 Function Overloading 2436.19 Function Templates 2466.20Recursion 2486.21 Example Using Recursion: Fibonacci Series 2526.22 Recursion vs. Iteration 2556.23 Wrap-Up 258 7 Class Templates array and vector; Catching Exceptions 2787.1 Introduction 2797.2 arrays 2797.3 Declaring arrays 2817.4 Examples Using arrays 2817.4.1 Declaring an array and Using a Loop to Initialize the array's Elements 2817.4.2 Initializing an array in a Declaration with an Initializer List 2827.4.3 Specifying an array's Size with a Constant Variable and Setting array Elements with Calculations 2837.4.4 Summing the Elements of an array 2867.4.5 Using Bar Charts to Display array Data Graphically 2867.4.6 Using the Elements of an array as Counters 2887.4.7 Using arrays to Summarize Survey Results 2897.4.8 Static Local arrays and Automatic Local arrays 2917.5 Range-Based for Statement 2937.6 Case Study: Class GradeBook Using an array to Store Grades 2957.7 Sorting and Searching arrays 3027.8 Multidimensional arrays 3047.9 Case Study: Class GradeBook Using a Two-Dimensional array 3077.10 Introduction to C++ Standard Library Class Template vector 3147.11 Wrap-Up 320 8 Pointers 3348.1 Introduction 3358.2 Pointer Variable Declarations and Initialization 3358.3 Pointer Operators 3378.4 Pass-by-Reference with Pointers 3398.5 Built-In Arrays 3448.6 Using const with Pointers 3468.6.1 Nonconstant Pointer to Nonconstant Data 3478.6.2 Nonconstant Pointer to Constant Data 3478.6.3 Constant Pointer to Nonconstant Data 3488.6.4 Constant Pointer to Constant Data 3498.7 sizeof Operator 3508.8 Pointer Expressions and Pointer Arithmetic 3538.9 Relationship Between Pointers and Built-In Arrays 3558.10 Pointer-Based Strings 3588.11 Wrap-Up 361 9 Classes: A Deeper Look; Throwing Exceptions 3779.1 Introduction 3789.2 Time Class Case Study 3799.3 Class Scope and Accessing Class Members 3859.4 Access Functions and Utility Functions 3869.5 Time Class Case Study: Constructors with Default Arguments 3879.6 Destructors 3939.7 When Constructors and Destructors Are Called 3939.8 Time Class Case Study: A Subtle Trap-Returning a Reference or a Pointer to a private Data Member 3979.9 Default Memberwise Assignment 4009.10 const Objects and const Member Functions 4029.11 Composition: Objects as Members of Classes 4049.12 friend Functions and friend Classes 4109.13 Using the this Pointer 4129.14 static Class Members 4189.15 Wrap-Up 423 10 Operator Overloading; Class string 43310.1 Introduction 43410.2 Using the Overloaded Operators of Standard Library Class string 43510.3 Fundamentals of Operator Overloading 43810.4 Overloading Binary Operators 43910.5 Overloading the Binary Stream Insertion and Stream Extraction Operators 44010.6 Overloading Unary Operators 44410.7 Overloading the Unary Prefix and Postfix ++ and -- Operators 44510.8 Case Study: A Date Class 44610.9 Dynamic Memory Management 45110.10 Case Study: Array Class 45310.10.1 Using the Array Class 45410.10.2 Array Class Definition 45810.11 Operators as Member vs. Non-Member Functions 46610.12 Converting Between Types 46610.13 explicit Constructors and Conversion Operators 46810.14 Overloading the Function Call Operator () 47010.15 Wrap-Up 471 11 Object-Oriented Programming: Inheritance 48211.1 Introduction 48311.2 Base Classes and Derived Classes 48311.3 Relationship between Base and Derived Classes 48611.3.1 Creating and Using a CommissionEmployee Class 48611.3.2 Creating a BasePlusCommissionEmployee Class Without Using Inheritance 49111.3.3 Creating a CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchy 49711.3.4 CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchy Using protected Data 50111.3.5 CommissionEmployee-BasePlusCommissionEmployeeInheritance Hierarchy Using private Data 504 11.4 Constructors and Destructors in Derived Classes 50911.5 public, protected and private Inheritance 51111.6 Software Engineering with Inheritance 51211.7 Wrap-Up 512 12 Object-Oriented Programming: Polymorphism 51712.1 Introduction 51812.2 Introduction to Polymorphism: Polymorphic Video Game 51912.3 Relationships Among Objects in an Inheritance Hierarchy 51912.3.1 Invoking Base-Class Functions from Derived-Class Objects 52012.3.2 Aiming Derived-Class Pointers at Base-Class Objects 52312.3.3 Derived-Class Member-Function Calls via Base-Class Pointers 52412.3.4 Virtual Functions and Virtual Destructors 52612.4 Type Fields and switch Statements 53312.5 Abstract Classes and Pure virtual Functions 53312.6 Case Study: Payroll System Using Polymorphism 53512.6.1 Creating Abstract Base Class Employee 53612.6.2 Creating Concrete Derived Class SalariedEmployee 54012.6.3 Creating Concrete Derived Class CommissionEmployee 54212.6.4 Creating Indirect Concrete Derived Class BasePlusCommissionEmployee 54412.6.5 Demonstrating Polymorphic Processing 54612.7 (Optional) Polymorphism, Virtual Functions and Dynamic Binding Under the Hood 55012.8 Case Study: Payroll System Using Polymorphism and Runtime Type Information with Downcasting, dynamic_cast, typeid and type_info 55312.9 Wrap-Up 557 13 Stream Input/Output: A Deeper Look 56213.1 Introduction 56313.2 Streams 56413.2.1 Classic Streams vs. Standard Streams 56413.2.2 iostream Library Headers 56513.2.3 Stream Input/Output Classes and Objects 56513.3 Stream Output 56713.3.1 Output of char * Variables 56813.3.2 Character Output Using Member Function put 56813.4 Stream Input 56913.4.1 get and getline Member Functions 56913.4.2 istream Member Functions peek, putback and ignore 57213.4.3 Type-Safe I/O 57213.5 Unformatted I/O Using read, write and gcount 57213.6 Introduction to Stream Manipulators 57313.6.1 Integral Stream Base: dec, oct, hex and setbase 57413.6.2 Floating-Point Precision (precision, setprecision) 57413.6.3 Field Width (width, setw) 57613.6.4 User-Defined Output Stream Manipulators 57713.7 Stream Format States and Stream Manipulators 57813.7.1 Trailing Zeros and Decimal Points (showpoint) 57913.7.2 Justification (left, right and internal) 58013.7.3 Padding (fill, setfill) 58213.7.4 Integral Stream Base (dec, oct, hex, showbase) 58313.7.5 Floating-Point Numbers; Scientific and Fixed Notation (scientific, fixed) 58413.7.6 Uppercase/Lowercase Control (uppercase) 58513.7.7 Specifying Boolean Format (boolalpha) 58513.7.8 Setting and Resetting the Format State via Member Function flags 58613.8 Stream Error States 58713.9 Tying an Output Stream to an Input Stream 59013.10 Wrap-Up 590 14 File Processing 59914.1 Introduction 60014.2 Files and Streams 60014.3 Creating a Sequential File 60114.4 Reading Data from a Sequential File 60514.5 Updating Sequential Files 61114.6 Random-Access Files 61114.7 Creating a Random-Access File 61214.8 Writing Data Randomly to a Random-Access File 61714.9 Reading from a Random-Access File Sequentially 61914.10 Case Study: A Transaction-Processing Program 62114.11 Object Serialization 62814.12 Wrap-Up 628 15 Standard Library Containers and Iterators 63815.1 Introduction 63915.2 Introduction to Containers 64015.3 Introduction to Iterators 64415.4 Introduction to Algorithms 64915.5 Sequence Containers 64915.5.1 vector Sequence Container 65015.5.2 list Sequence Container 65815.5.3 deque Sequence Container 66215.6 Associative Containers 66415.6.1 multiset Associative Container 66515.6.2 set Associative Container 66815.6.3 multimap Associative Container 66915.6.4 map Associative Container 67115.7 Container Adapters 67315.7.1 stack Adapter 67315.7.2 queue Adapter 67515.7.3 priority_queue Adapter 67615.8 Class bitset 67715.9 Wrap-Up 679 16 Standard Library Algorithms 69016.1 Introduction 69116.2 Minimum Iterator Requirements 69116.3 Algorithms 69316.3.1 fill, fill_n, generate and generate_n 69316.3.2 equal, mismatch and lexicographical_compare 69516.3.3 remove, remove_if, remove_copy and remove_copy_if 69716.3.4 replace, replace_if, replace_copy and replace_copy_if 70016.3.5 Mathematical Algorithms 70216.3.6 Basic Searching and Sorting Algorithms 70616.3.7 swap, iter_swap and swap_ranges 71016.3.8 copy_backward, merge, unique and reverse 71116.3.9 inplace_merge, unique_copy and reverse_copy 71416.3.10 Set Operations 71616.3.11 lower_bound, upper_bound and equal_range 71916.3.12Heapsort 72116.3.13 min, max, minmax and minmax_element 72416.4 Function Objects 72616.5 Lambda Expressions 72916.6 Standard Library Algorithm Summary 73016.7 Wrap-Up 732 17 Exception Handling: A Deeper Look 74017.1 Introduction 74117.2 Example: Handling an Attempt to Divide by Zero 74117.3 Rethrowing an Exception 74717.4 Stack Unwinding 74817.5 When to Use Exception Handling 75017.6 Constructors, Destructors and Exception Handling 75117.7 Exceptions and Inheritance 75217.8 Processing new Failures 75217.9 Class unique_ptr and Dynamic Memory Allocation 75517.10 Standard Library Exception Hierarchy 75817.11 Wrap-Up 759 18 Introduction to Custom Templates 76518.1 Introduction 76618.2 Class Templates 76618.3 Function Template to Manipulate a Class-Template Specialization Object 77118.4 Nontype Parameters 77318.5 Default Arguments for Template Type Parameters 77318.6 Overloading Function Templates 77418.7 Wrap-Up 774 19 Custom Templatized Data Structures 77719.1 Introduction 77819.2 Self-Referential Classes 77919.3 Linked Lists 78019.4Stacks 79419.5Queues 79919.6Trees 80319.7 Wrap-Up 811 20 Searching and Sorting 82220.1 Introduction 82320.2 Searching Algorithms 82420.2.1 Linear Search 82420.2.2 Binary Search 82720.3 Sorting Algorithms 83120.3.1 Insertion Sort 83220.3.2 Selection Sort 83420.3.3 Merge Sort (A Recursive Implementation) 83720.4 Wrap-Up 843 21 Class string and String Stream Processing: A Deeper Look 84921.1 Introduction 85021.2 string Assignment and Concatenation 85121.3 Comparing strings 85321.4 Substrings 85621.5 Swapping strings 85621.6 string Characteristics 85721.7 Finding Substrings and Characters in a string 85921.8 Replacing Characters in a string 86121.9 Inserting Characters into a string 86321.10 Conversion to Pointer-Based char * Strings 86421.11 Iterators 86521.12 String Stream Processing 86721.13 C++11 Numeric Conversion Functions 87021.14 Wrap-Up 871 22 Bits, Characters, C Strings and structs 87922.1 Introduction 88022.2 Structure Definitions 88022.3 typedef 88222.4 Example: Card Shuffling and Dealing Simulation 88222.5 Bitwise Operators 88522.6 Bit Fields 89422.7 Character-Handling Library 89722.8 C String-Manipulation Functions 90322.9 C String-Conversion Functions 91022.10 Search Functions of the C String-Handling Library 91522.11 Memory Functions of the C String-Handling Library 91922.12 Wrap-Up 923 23 Other Topics 93823.1 Introduction 93923.2 const_cast Operator 93923.3 mutable Class Members 94123.4 namespaces 94323.5 Operator Keywords 94623.6 Pointers to Class Members (.* and ->*) 94823.7 Multiple Inheritance 95023.8 Multiple Inheritance and virtual Base Classes 95523.9 Wrap-Up 959 List of Chapters on the Web 965 A Operator Precedence and Associativity 967 B ASCII Character Set 969 C Fundamental Types 970 D Number Systems 972D.1 Introduction 973D.2 Abbreviating Binary Numbers as Octal and Hexadecimal Numbers 976D.3 Converting Octal and Hexadecimal Numbers to Binary Numbers 977D.4 Converting from Binary, Octal or Hexadecimal to Decimal 977D.5 Converting from Decimal to Binary, Octal or Hexadecimal 978D.6 Negative Binary Numbers: Two's Complement Notation 980 E Preprocessor 985E.1 Introduction 986E.2 #include Preprocessing Directive 986E.3 #define Preprocessing Directive: Symbolic Constants 987E.4 #define Preprocessing Directive: Macros 987E.5 Conditional Compilation 989E.6 #error and #pragma Preprocessing Directives 990E.7 Operators # and ## 991E.8 Predefined Symbolic Constants 991E.9 Assertions 992E.10Wrap-Up 992 List of Appendices on the Web 997Index 999 Online Chapters and AppendicesChapters 24-26 and Appendices F-K are PDF documents posted online at the book's Companion Website, which is accessible from www.pearsonhighered.com/deitel 24 C++11 Additional Features 24-1 25 ATM Case Study, Part 1: Object-Oriented Design with the UML 25-125.1 Introduction 25-225.2 Introduction to Object-Oriented Analysis and Design 25-225.3 Examining the ATM Requirements Document 25-325.4 Identifying the Classes in the ATM Requirements Document 25-1025.5 Identifying Class Attributes 25-1725.6 Identifying Objects' States and Activities 25-2125.7 Identifying Class Operations 25-2525.8 Indicating Collaboration Among Objects 25-3225.9 Wrap-Up 25-39 26 ATM Case Study, Part 2: Implementing an Object-Oriented Design 26-126.1 Introduction 26-226.2 Starting to Program the Classes of the ATM System 26-226.3 Incorporating Inheritance into the ATM System 26-826.4 ATM Case Study Implementation 26-1526.4.1 Class ATM 26-1626.4.2 Class Screen 26-2326.4.3 Class Keypad 26-2526.4.4 Class CashDispenser 26-2626.4.5 Class DepositSlot 26-2826.4.6 Class Account 26-2926.4.7 Class BankDatabase 26-3126.4.8 Class Transaction 26-3526.4.9 Class BalanceInquiry 26-3726.4.10 Class Withdrawal 26-3926.4.11 Class Deposit 26-4426.4.12 Test Program ATMCaseStudy.cpp 26-4726.5 Wrap-Up 26-47 F C Legacy Code Topics F-1F.1 Introduction F-2F.2 Redirecting Input/Output on UNIX/Linux/Mac OS X and Windows Systems F-2F.3 Variable-Length Argument Lists F-3F.4 Using Command-Line Arguments F-5F.5 Notes on Compiling Multiple-Source-File Programs F-7F.6 Program Termination with exit and atexit F-9F.7 Type Qualifier volatile F-10F.8 Suffixes for Integer and Floating-Point Constants F-10F.9 Signal Handling F-11F.10 Dynamic Memory Allocation with calloc and realloc F-13F.11 Unconditional Branch: goto F-14F.12 Unions F-15F.13 Linkage Specifications F-18F.14 Wrap-Up F-19 G UML 2: Additional Diagram Types G-1G.1 Introduction G-1G.2 Additional Diagram Types G-2 H Using the Visual Studio Debugger H-1H.1 Introduction H-2H.2 Breakpoints and the Continue Command H-2H.3 Locals and Watch Windows H-8H.4 Controlling Execution Using the Step Into, Step Over, Step Out and Continue Commands H-11H.5 Autos Window H-13H.6 Wrap-Up H-14 I Using the GNU C++ Debugger I-1I.1 Introduction I-2I.2 Breakpoints and the run, stop, continue and print Commands I-2I.3 print and set Commands I-8I.4 Controlling Execution Using the step, finish and next Commands I-10I.5 watch Command I-13I.6 Wrap-Up I-15 J Using the Xcode Debugger J-1 K Test Driving a C++ Program on Mac OS X K-1 [Note: The test drives for Windows and Linux are in Chapter 1.]ReviewsAuthor InformationTab Content 6Author Website:Countries AvailableAll regions |