دسترسی نامحدود
برای کاربرانی که ثبت نام کرده اند
برای ارتباط با ما می توانید از طریق شماره موبایل زیر از طریق تماس و پیامک با ما در ارتباط باشید
در صورت عدم پاسخ گویی از طریق پیامک با پشتیبان در ارتباط باشید
برای کاربرانی که ثبت نام کرده اند
درصورت عدم همخوانی توضیحات با کتاب
از ساعت 7 صبح تا 10 شب
ویرایش: 10 نویسندگان: Paul Deitel, Harvey Deitel سری: ISBN (شابک) : 0134448235, 9780134448237 ناشر: Pearson سال نشر: 2016 تعداد صفحات: 3015 زبان: English فرمت فایل : PDF (درصورت درخواست کاربر به PDF، EPUB یا AZW3 تبدیل می شود) حجم فایل: 68 مگابایت
در صورت تبدیل فایل کتاب C++ How to Program: Introducing the New C++14 Standard به فرمت های PDF، EPUB، AZW3، MOBI و یا DJVU می توانید به پشتیبان اطلاع دهید تا فایل مورد نظر را تبدیل نمایند.
توجه داشته باشید کتاب C نحوه برنامه ریزی: معرفی استاندارد جدید C 14 نسخه زبان اصلی می باشد و کتاب ترجمه شده به فارسی نمی باشد. وبسایت اینترنشنال لایبرری ارائه دهنده کتاب های زبان اصلی می باشد و هیچ گونه کتاب ترجمه شده یا نوشته شده به فارسی را ارائه نمی دهد.
C++ HOW TO PROGRAM Introducing the New C++14 Standard How To Program Series Deitel® Developer Series Simply Series VitalSource Web Books LiveLessons Video Learning Products C++ How to Program Introducing the New C++14 Standard Trademarks Contents Preface Contacting the Authors Join the Deitel & Associates, Inc. Social Media Communities The C++11 and C++14 Standards Key Features of C++ How to Program, 10/e New in This Edition Object-Oriented Programming Hundreds of Code Examples Exercises Illustrations and Figures Dependency Chart Teaching Approach Secure C++ Programming Online Chapters, Appendices and Other Content Obtaining the Software Used in C++ How to Program, 10/e Instructor Supplements Online Practice and Assessment with MyProgrammingLab™ Reviewers About the Authors Before You Begin 1 Introduction to Computers and C++ Objectives Outline 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 and 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.10.1 Compiling and Running an Application in Visual Studio 2015 for Windows 1.10.2 Compiling and Running Using GNU C++ on Linux 1.10.3 Compiling and Running with Xcode on Mac OS X 1.11 Operating Systems 1.12 The Internet and the World Wide Web 1.13 Some Key Software Development Terminology 1.14 C++11 and C++14: The Latest C++ Versions 1.15 Boost C++ Libraries 1.16 Keeping Up to Date with Information Technologies Self-Review Exercises Exercises Making a Difference Making a Difference Resources 2 Introduction to C++ Programming, Input/Output and Operators Objectives Outline 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 Exercises Making a Difference 3 Introduction to Classes, Objects, Member Functions and Strings Objectives Outline 3.1 Introduction 1 3.2 Test-Driving an Account Object 3.2.1 Instantiating an Object 3.2.2 Headers and Source-Code Files 3.2.3 Calling Class Account’s getName Member Function 3.2.4 Inputting a string with getline 3.2.5 Calling Class Account’s setName Member Function 3.3 Account Class with a Data Member and Set and Get Member Functions 3.3.1 Account Class Definition 3.3.2 Keyword class and the Class Body 3.3.3 Data Member name of Type string 3.3.4 setName Member Function 3.3.5 getName Member Function 3.3.6 Access Specifiers private and public 3.3.7 Account UML Class Diagram 3.4 Account Class: Initializing Objects with Constructors 3.4.1 Defining an Account Constructor for Custom Object Initialization 3.4.2 Initializing Account Objects When They’re Created 3.4.3 Account UML Class Diagram with a Constructor 3.5 Software Engineering with Set and Get Member Functions 3.6 Account Class with a Balance; Data Validation 3.6.1 Data Member balance 3.6.2 Two-Parameter Constructor with Validation 3.6.3 deposit Member Function with Validation 3.6.4 getBalance Member Function 3.6.5 Manipulating Account Objects with Balances 3.6.6 Account UML Class Diagram with a Balance and Member Functions deposit and getBalance 3.7 Wrap-Up Summary Self-Review Exercises Exercises Making a Difference 4 Algorithm Development and Control Statements: Part 1 Objectives Outline 4.1 Introduction 4.2 Algorithms 4.3 Pseudocode 4.4 Control Structures 4.5 if Single-Selection Statement 4.6 if…else Double-Selection Statement 4.7 Student Class: Nested if…else Statements 4.8 while Iteration Statement 4.9 Formulating Algorithms: Counter-Controlled Iteration 4.9.1 Pseudocode Algorithm with Counter-Controlled Iteration 4.9.2 Implementing Counter-Controlled Iteration 4.9.3 Notes on Integer Division and Truncation 4.9.4 Arithmetic Overflow 4.9.5 Input Validation 4.10 Formulating Algorithms: Sentinel-Controlled Iteration 4.10.1 Top-Down, Stepwise Refinement: The Top and First Refinement 4.10.2 Proceeding to the Second Refinement 4.10.3 Implementing Sentinel-Controlled Iteration 4.10.4 Converting Between Fundamental Types Explicitly and Implicitly 4.10.5 Formatting Floating-Point Numbers 4.10.6 Unsigned Integers and User Input 4.11 Formulating Algorithms: Nested Control Statements 4.11.1 Problem Statement 4.11.2 Top-Down, Stepwise Refinement: Pseudocode Representation of the Top 4.11.3 Top-Down, Stepwise Refinement: First Refinement 4.11.4 Top-Down, Stepwise Refinement: Second Refinement 4.11.5 Complete Second Refinement of the Pseudocode 4.11.6 Program That Implements the Pseudocode Algorithm 4.11.7 Preventing Narrowing Conversions with List Initialization 4.12 Compound Assignment Operators 4.13 Increment and Decrement Operators 4.14 Fundamental Types Are Not Portable 4.15 Wrap-Up Summary Self-Review Exercises Exercises Making a Difference 5 Control Statements: Part 2; Logical Operators Objectives Outline 5.1 Introduction 5.2 Essentials of Counter-Controlled Iteration 5.3 for Iteration Statement 5.4 Examples Using the for Statement 5.5 Application: Summing Even Integers 5.6 Application: Compound-Interest Calculations 5.7 Case Study: Integer-Based Monetary Calculations with Class DollarAmount 5.7.1 Demonstrating Class DollarAmount 5.7.2 Class DollarAmount C++11 Type int64_t DollarAmount Constructor DollarAmount Member Functions add and subtract DollarAmount Member Function addInterest Member Function toString Banker’s Rounding Even int64_t Is Limited A Note About Arithmetic Operators and Modifying Operands 5.8 do…while Iteration Statement 5.9 switch Multiple-Selection Statement 5.10 break and continue Statements 5.11 Logical Operators 5.11.1 Logical AND (&&) Operator 5.11.2 Logical OR (||) Operator 5.11.3 Short-Circuit Evaluation 5.11.4 Logical Negation (!) Operator 5.11.5 Logical Operators Example 5.12 Confusing the Equality (==) and Assignment (=) Operators 5.13 Structured-Programming Summary 5.14 Wrap-Up Summary Self-Review Exercises Exercises Making a Difference 6 Functions and an Introduction to Recursion Objectives Outline 6.1 Introduction 6.2 Program Components in C++ 6.3 Math Library Functions 6.4 Function Prototypes 6.5 Function-Prototype and Argument-Coercion Notes 6.6 C++ Standard Library Headers 6.7 Case Study: Random-Number Generation2 6.7.1 Rolling a Six-Sided Die 6.7.2 Rolling a Six-Sided Die 60,000,000 Times 6.7.3 Randomizing the Random-Number Generator with srand 6.7.4 Seeding the Random-Number Generator with the Current Time 6.7.5 Scaling and Shifting Random Numbers 6.8 Case Study: Game of Chance; Introducing Scoped enums 6.9 C++11 Random Numbers 6.10 Scope Rules 6.11 Function-Call Stack and Activation Records 6.12 Inline Functions 6.13 References and Reference Parameters 6.14 Default Arguments 6.15 Unary Scope Resolution Operator 6.16 Function Overloading 6.17 Function Templates 6.18 Recursion 6.19 Example Using Recursion: Fibonacci Series 6.20 Recursion vs. Iteration 6.21 Wrap-Up Summary Self-Review Exercises Exercises Making a Difference 7 Class Templates array and vector; Catching Exceptions Objectives Outline 7.1 Introduction 7.2 arrays 7.3 Declaring arrays 7.4 Examples Using arrays The following examples demonstrate how to declare, initialize and manipulate arrays. 7.4.1 Declaring an array and Using a Loop to Initialize the array’s Elements 7.4.2 Initializing an array in a Declaration with an Initializer List 7.4.3 Specifying an array’s Size with a Constant Variable and Setting array Elements with Calculations 7.4.4 Summing the Elements of an array 7.4.5 Using a Bar Chart to Display array Data Graphically 7.4.6 Using the Elements of an array as Counters 7.4.7 Using arrays to Summarize Survey Results 7.4.8 Static Local arrays and Automatic Local 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 Exercises Recursion Exercises Making a Difference 8 Pointers Objectives Outline 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 (Optional) 8.11 Note About Smart Pointers 8.12 Wrap-Up Summary Self-Review Exercises Exercises Special Section: Building Your Own Computer 9 Classes: A Deeper Look Objectives Outline 9.1 Introduction 9.2 Time Class Case Study: Separating Interface from Implementation 9.2.1 Interface of a Class 9.2.2 Separating the Interface from the Implementation 9.2.3 Time Class Definition 9.2.4 Time Class Member Functions 9.2.5 Scope Resolution Operator (::) 9.2.6 Including the Class Header in the Source-Code File 9.2.7 Time Class Member Function setTime and Throwing Exceptions 9.2.8 Time Class Member Function toUniversalString and String Stream Processing 9.2.9 Time Class Member Function toStandardString 9.2.10 Implicitly Inlining Member Functions 9.2.11 Member Functions vs. Global Functions 9.2.12 Using Class Time 9.2.13 Object Size 9.3 Compilation and Linking Process 9.4 Class Scope and Accessing Class Members 9.5 Access Functions and Utility Functions 9.6 Time Class Case Study: Constructors with Default Arguments The program of Figs. 9.5–9.7 enhances class Time to demonstrate how arguments can be passed to a constructor implicitly. 9.6.1 Constructors with Default Arguments 9.6.2 Overloaded Constructors and C++11 Delegating Constructors 9.7 Destructors 9.8 When Constructors and Destructors Are Called 9.8.1 Constructors and Destructors for Objects in Global Scope 9.8.2 Constructors and Destructors for Non-static Local Objects 9.8.3 Constructors and Destructors for static Local Objects 9.8.4 Demonstrating When Constructors and Destructors Are Called 9.9 Time Class Case Study: A Subtle Trap — Returning a Reference or a Pointer to a private Data Member 9.10 Default Memberwise Assignment 9.11 const Objects and const Member Functions 9.12 Composition: Objects as Members of Classes 9.13 friend Functions and friend Classes 9.14 Using the this Pointer 9.14.1 Implicitly and Explicitly Using the this Pointer to Access an Object’s Data Members 9.14.2 Using the this Pointer to Enable Cascaded Function Calls 9.15 static Class Members 9.15.1 Motivating Classwide Data 9.15.2 Scope and Initialization of static Data Members 9.15.3 Accessing static Data Members 9.15.4 Demonstrating static Data Members 9.16 Wrap-Up Summary Self-Review Exercises Exercises Making a Difference 10 Operator Overloading; Class string Objectives Outline 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 Increment and Decrement Operators 10.8 Case Study: A Date Class 10.9 Dynamic Memory Management 10.10 Case Study: Array Class 10.10.1 Using the Array Class 10.10.2 Array Class Definition Overloading the Stream Insertion and Stream Extraction Operators as friends Range-Based for Does Not Work with Dynamically Allocated Built-In Arrays Array Default Constructor Array Copy Constructor Array Destructor getSize Member Function Overloaded Assignment Operator C++11: Move Constructor and Move Assignment Operator C++11: Deleting Unwanted Member Functions from Your Class Overloaded Equality and Inequality Operators Overloaded Subscript Operators C++11: Managing Dynamically Allocated Memory with unique_ptr C++11: Passing a List Initializer to a Constructor 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 Exercises 11 Object-Oriented Programming: Inheritance Objectives Outline 11.1 Introduction 11.2 Base Classes and Derived Classes 11.3 Relationship between Base and Derived Classes 11.3.1 Creating and Using a CommissionEmployee Class 11.3.2 Creating a BasePlusCommissionEmployee Class Without Using Inheritance 11.3.3 Creating a CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy 11.3.4 CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy Using protected Data Defining Base-Class CommissionEmployee with protected Data Class BasePlusCommissionEmployee Testing the Modified BasePlusCommissionEmployee Class Notes on Using protected Data 11.3.5 CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy Using private Data Changes to Class CommissionEmployee’s Member-Function Definitions Changes to Class BasePlusCommissionEmployee’s Member-Function Definitions BasePlusCommissionEmployee Member Function earnings BasePlusCommissionEmployee Member Function toString Testing the Modified Class Hierarchy Summary of the CommissionEmployee–BasePlusCommissionEmployee Examples 11.4 Constructors and Destructors in Derived Classes 11.5 public, protected and private Inheritance 11.6 Wrap-Up Summary Self-Review Exercises Exercises 12 Object-Oriented Programming: Polymorphism Objectives Outline 12.1 Introduction 12.2 Introduction to Polymorphism: Polymorphic Video Game 12.3 Relationships Among Objects in an Inheritance Hierarchy 12.3.1 Invoking Base-Class Functions from Derived-Class Objects 12.3.2 Aiming Derived-Class Pointers at Base-Class Objects 12.3.3 Derived-Class Member-Function Calls via Base-Class Pointers 12.4 Virtual Functions and Virtual Destructors 12.4.1 Why virtual Functions Are Useful 12.4.2 Declaring virtual Functions 12.4.3 Invoking a virtual Function Through a Base-Class Pointer or Reference 12.4.4 Invoking a virtual Function Through an Object’s Name 12.4.5 virtual Functions in the CommissionEmployee Hierarchy 12.4.6 virtual Destructors 12.4.7 C++11: final Member Functions and Classes 12.5 Type Fields and switch Statements 12.6 Abstract Classes and Pure virtual Functions 12.7 Case Study: Payroll System Using Polymorphism 12.7.1 Creating Abstract Base Class Employee 12.7.2 Creating Concrete Derived Class SalariedEmployee 12.7.3 Creating Concrete Derived Class CommissionEmployee 12.7.4 Creating Indirect Concrete Derived Class BasePlusCommissionEmployee 12.7.5 Demonstrating Polymorphic Processing 12.8 (Optional) Polymorphism, Virtual Functions and Dynamic Binding “Under the Hood” 12.9 Case Study: Payroll System Using Polymorphism and Runtime Type Information with Downcasting, dynamic_cast, typeid and type_info 12.10 Wrap-Up Summary Section 12.1 Introduction Section 12.2 Introduction to Polymorphism: Polymorphic Video Game Section 12.3 Relationships Among Objects in an Inheritance Hierarchy Section 12.4.2 Declaring virtual Functions Polymorphism is implemented via virtual functions (p. 540) and dynamic binding (p. 541). Section 12.4.3 Invoking a virtual Function Through a Base-Class Pointer or Reference Section 12.4.4 Invoking a virtual Function Through an Object’s Name Section 12.4.5 virtual Functions in the CommissionEmployee Hierarchy Section 12.4.6 virtual Destructors Section 12.4.7 C++11: final Member Functions and Classes Section 12.5 Type Fields and switch Statements Section 12.6 Abstract Classes and Pure virtual Functions Section 12.6.1 Pure Virtual Functions Section 12.8 (Optional) Polymorphism, Virtual Functions and Dynamic Binding “Under the Hood” Section 12.9 Case Study: Payroll System Using Polymorphism and Runtime Type Information with Downcasting, dynamic_cast, typeid and type_info Self-Review Exercises Exercises Making a Difference 13 Stream Input/Output: A Deeper Look Objectives Outline 13.1 Introduction 13.2 Streams 13.3 Stream Output 13.4 Stream Input 13.4.1 get and getline Member Functions 13.4.2 istream Member Functions peek, putback and ignore 13.4.3 Type-Safe I/O 13.5 Unformatted I/O Using read, write and gcount 13.6 Stream Manipulators: A Deeper Look 13.6.1 Integral Stream Base: dec, oct, hex and setbase 13.6.2 Floating-Point Precision (precision, setprecision) 13.6.3 Field Width (width, setw) 13.6.4 User-Defined Output Stream Manipulators 13.7 Stream Format States and Stream Manipulators 13.7.1 Trailing Zeros and Decimal Points (showpoint) 13.7.2 Justification (left, right and internal) 13.7.3 Padding (fill, setfill) 13.7.4 Integral Stream Base (dec, oct, hex, showbase) 13.7.5 Floating-Point Numbers; Scientific and Fixed Notation (scientific, fixed) 13.7.6 Uppercase/Lowercase Control (uppercase) 13.7.7 Specifying Boolean Format (boolalpha) 13.7.8 Setting and Resetting the Format State via Member Function flags 13.8 Stream Error States 13.9 Tying an Output Stream to an Input Stream 13.10 Wrap-Up Summary Section 13.1 Introduction Section 13.2 Streams Section 13.2.2 iostream Library Headers Section 13.2.3 Stream Input/Output Classes and Objects Section 13.3 Stream Output Section 13.4 Stream Input Section 13.5 Unformatted I/O Using read, write and gcount Section 13.6 Stream Manipulators: A Deeper Look Section 13.7 Stream Format States and Stream Manipulators Section 13.8 Stream Error States Section 13.9 Tying an Output Stream to an Input Stream Self-Review Exercises Exercises 14 File Processing Objectives Outline 14.1 Introduction 14.2 Files and Streams 14.3 Creating a Sequential File 14.4 Reading Data from a Sequential File 14.4.1 Opening a File for Input 14.4.2 Reading from the File 14.4.3 File-Position Pointers 14.4.4 Case Study: Credit Inquiry Program 14.5 C++14: Reading and Writing Quoted Text 14.6 Updating Sequential Files 14.7 Random-Access Files 14.8 Creating a Random-Access File 14.8.1 Writing Bytes with ostream Member Function write 14.8.2 Converting Between Pointer Types with the reinterpret_cast Operator 14.8.3 Credit-Processing Program 14.8.4 Opening a File for Output in Binary Mode 14.9 Writing Data Randomly to a Random-Access File 14.10 Reading from a Random-Access File Sequentially 14.11 Case Study: A Transaction-Processing Program 14.12 Object Serialization 14.13 Wrap-Up Summary Section 14.1 Introduction Section 14.2 Files and Streams Section 14.3 Creating a Sequential File Section 14.4 Reading Data from a Sequential File Section 14.5 C++14: Reading and Writing Quoted Text Section 14.6 Updating Sequential Files Self-Review Exercises Exercises Making a Difference 15 Standard Library Containers and Iterators Objectives Outline 15.1 Introduction 15.2 Introduction to Containers2 15.3 Introduction to Iterators 15.4 Introduction to Algorithms 15.5 Sequence Containers 15.5.1 vector Sequence Container Using vectors and Iterators Creating a vector vector Member Functions size and capacity vector Member Function push_back Updated size and capacity After Modifying a vector vector Growth Outputting Built-in Array Contents with Pointers Outputting vector Contents with Iterators Displaying the vector’s Contents in Reverse with const_reverse_iterators C++11: shrink_to_fit vector Element-Manipulation Functions ostream_iterator copy Algorithm vector Member Functions front and back Accessing vector Elements vector Member Function insert vector Member Function erase vector Member Function insert with Three Arguments (Range insert) vector Member Function clear 15.5.2 list Sequence Container C++11: forward_list Container list Member Functions Creating list Objects list Member Function sort list Member Function splice list Member Function merge list Member Function pop_front list Member Function unique list Member Function swap list Member Functions assign and remove 15.5.3 deque Sequence Container 15.6 Associative Containers 15.6.1 multiset Associative Container 15.6.2 set Associative Container 15.6.3 multimap Associative Container 15.6.4 map Associative Container 15.7 Container Adapters 15.7.1 stack Adapter 15.7.2 queue Adapter 15.7.3 priority_queue Adapter 15.8 Class bitset 15.9 Wrap-Up Summary Section 15.1 Introduction Section 15.2 Introduction to Containers Section 15.3 Introduction to Iterators Section 15.4 Introduction to Algorithms Section 15.5 Sequence Containers Section 15.5.1 vector Sequence Container Section 15.5.2 list Sequence Container Section 15.5.3 deque Sequence Container Section 15.6 Associative Containers Section 15.6.1 multiset Associative Container Section 15.6.2 set Associative Container Section 15.6.3 multimap Associative Container Section 15.6.4 map Associative Container Section 15.7 Container Adapters Section 15.7.1 stack Adapter Section 15.7.2 queue Adapter Section 15.7.3 priority_queue Adapter Section 15.8 Class bitset Self-Review Exercises Exercises Recommended Reading 16 Standard Library Algorithms Objectives Outline 16.1 Introduction 16.2 Minimum Iterator Requirements 16.3 Lambda Expressions 16.4 Algorithms Sections 16.4.1–16.4.12 demonstrate many of the Standard Library algorithms. 16.4.1 fill, fill_n, generate and generate_n 16.4.2 equal, mismatch and lexicographical_compare 16.4.3 remove, remove_if, remove_copy and remove_copy_if 16.4.4 replace, replace_if, replace_copy and replace_copy_if 16.4.5 Mathematical Algorithms 16.4.6 Basic Searching and Sorting Algorithms 16.4.7 swap, iter_swap and swap_ranges 16.4.8 copy_backward, merge, unique and reverse 16.4.9 inplace_merge, unique_copy and reverse_copy 16.4.10 Set Operations 16.4.11 lower_bound, upper_bound and equal_range 16.4.12 min, max, minmax and minmax_element 16.5 Function Objects Advantages of Function Objects over Function Pointers Predefined Function Objects of the Standard Template Library Using the accumulate Algorithm 16.6 Standard Library Algorithm Summary 16.7 Wrap-Up Summary Section 16.1 Introduction Section 16.3 Lambda Expressions Section 16.3.1 Algorithm for_each Section 16.3.2 Lambda with an Empty Introducer Section 16.3.3 Lambda with a Nonempty Introducer—Capturing Local Variables Section 16.3.4 Lambda Return Types Section 16.4.1 fill, fill_n, generate and generate_n Section 16.4.2 equal, mismatch and lexicographical_compare Section 16.4.3 remove, remove_if, remove_copy and remove_copy_if Section 16.4.4 replace, replace_if, replace_copy and replace_copy_if Section 16.4.5 Mathematical Algorithms Section 16.4.6 Basic Searching and Sorting Algorithms Section 16.4.7 swap, iter_swap and swap_ranges Section 16.4.8 copy_backward, merge, unique and reverse Section 16.4.9 inplace_merge, unique_copy and reverse_copy Section 16.4.10 Set Operations Section 16.4.11 lower_bound, upper_bound and equal_range Section 16.4.12 min, max, minmax and minmax_element Section 16.5 Function Objects Self-Review Exercises Exercises 17 Exception Handling: A Deeper Look Objectives Outline 17.1 Introduction 17.2 Exception-Handling Flow of Control; Defining an Exception Class 17.2.4 Defining a catch Handler to Process a DivideByZeroException 17.3 Rethrowing an Exception 17.4 Stack Unwinding 17.5 When to Use Exception Handling 17.6 noexcept: Declaring Functions That Do Not Throw Exceptions 17.7 Constructors, Destructors and Exception Handling 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 Section 17.1 Introduction Section 17.2.1 Defining an Exception Class to Represent the Type of Problem That Might Occur Section 17.2.5 Termination Model of Exception Handling Section 17.2.7 Flow of Program Control When the User Enters a Denominator of Zero Section 17.3 Rethrowing an Exception Section 17.4 Stack Unwinding Section 17.5 When to Use Exception Handling Section 17.6 noexcept: Declaring Functions That Do Not Throw Exceptions Section 17.7.1 Destructors Called Due to Exceptions Section 17.7.2 Initializing Local Objects to Acquire Resources Section 17.8 Processing new Failures Section 17.9 Class unique_ptr and Dynamic Memory Allocation Section 17.10 Standard Library Exception Hierarchy Self-Review Exercises Exercises 18 Introduction to Custom Templates Objectives Outline 18.1 Introduction 18.2 Class Templates 18.2.1 Creating Class Template Stack18.2.2 Class Template Stack ’s Data Representation 18.2.3 Class Template Stack ’s Member Functions 18.2.4 Declaring a Class Template’s Member Functions Outside the Class Template Definition 18.2.5 Testing Class Template Stack 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 Exercises 19 Custom Templatized Data Structures Objectives Outline 19.1 Introduction 19.2 Self-Referential Classes 19.3 Linked Lists 19.3.1 Testing Our Linked List Implementation 19.3.2 Class Template ListNode 19.3.3 Class Template List 19.3.4 Member Function insertAtFront 19.3.5 Member Function insertAtBack 19.3.6 Member Function removeFromFront 19.3.7 Member Function removeFromBack 19.3.8 Member Function print 19.3.9 Circular Linked Lists and Double Linked Lists 19.4 Stacks 19.4.1 Taking Advantage of the Relationship Between Stack and List 19.4.2 Implementing a Class Template Stack Class Based By Inheriting from List 19.4.3 Dependent Names in Class Templates 19.4.4 Testing the Stack Class Template 19.4.5 Implementing a Class Template Stack Class With Composition of a List Object 19.5 Queues 19.6 Trees 19.6.1 Basic Terminology 19.6.2 Binary Search Trees 19.6.3 Testing the Tree Class Template 19.6.4 Class Template TreeNode 19.6.5 Class Template Tree 19.6.6 Tree Member Function insertNodeHelper 19.6.7 Tree Traversal Functions 19.6.8 Duplicate Elimination 19.6.9 Overview of the Binary Tree Exercises 19.7 Wrap-Up Summary Self-Review Exercises Exercises Special Section: Building Your Own Compiler 20 Searching and Sorting Objectives Outline 20.1 Introduction 20.2 Searching Algorithms 20.2.1 Linear Search Function Template linearSearch Big O: Constant Runtime Big O: Linear Runtime Big O: Quadratic Runtime O(n2) Performance Linear Search’s Runtime 20.2.2 Binary Search Binary Search of 15 Integer Values Binary Search Example Function Template binarySearch Function main Efficiency of Binary Search 20.3 Sorting Algorithms 20.3.1 Insertion Sort 20.3.2 Selection Sort 20.3.3 Merge Sort (A Recursive Implementation) Sample Merge Recursive Implementation Demonstrating Merge Sort Function mergeSort Function merge Efficiency of Merge Sort Summary of Searching and Sorting Algorithm Efficiencies 20.4 Wrap-Up Summary Self-Review Exercises Exercises 21 Class string and String Stream Processing: A Deeper Objectives Outline 21.1 Introduction1 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 Exercises Making a Difference 22 Bits, Characters, C Strings and structs Objectives Outline 22.1 Introduction 22.2 Structure Definitions 22.3 typedef and using 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 Exercises Special Section: Advanced String-Manipulation Exercises Challenging String-Manipulation Projects Chapters on the Web A Operator Precedence and Associativity B ASCII Character Set C Fundamental Types D Number Systems Objectives Outline 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 Objectives Outline 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 Appendices on the Web Index Symbols Numerics A B C D E F G H I J K L M N O P Q R S T U V W X Y Z