370 likes | 719 Views
C++ How to Program 4/e. Author: Deitel http://www.deitel.com/books Prentice Hall, Inc . Review Presents an easy introduction to C++ programming, by using trivial examples: Going from basic C (chapters 1-5) to OO concepts (chapters 6 and 7). Covers all topics in great detail.
E N D
C++ How to Program 4/e Author: Deitel http://www.deitel.com/books Prentice Hall, Inc. Review • Presents an easy introduction to C++ programming, by using trivial examples: • Going from basic C (chapters 1-5) to OO concepts (chapters 6 and 7). • Covers all topics in great detail. • C++ mainly in chapters 8, 9 and 10. • Templates in chapter 11. • Advanced topics in chapters 12-22. • Data Structures chapter 17. • STL chapter 21.
Chapter 1 – Introduction to Computers and C++ Programming Outline1.1 Introduction1.2 What is a Computer?1.3 Computer Organization1.4 Evolution of Operating Systems1.5 Personal Computing, Distributed Computing and Client/Server Computing1.6 Machine Languages, Assembly Languages, and High-Level Languages1.7 History of C and C++1.8 C++ Standard Library1.9 Java1.10 Visual Basic, Visual C++ and C#1.11 Other High-Level Languages1.12 Structured Programming1.13 The Key Software Trend: Object Technology1.14 Basics of a Typical C++ Environment1.15 Hardware Trends
Chapter 1 – Introduction to Computers and C++ Programming Outline1.16 History of the Internet1.17 History of the World Wide Web1.18 World Wide Web Consortium (W3C)1.19 General Notes About C++ and This Book1.20 Introduction to C++ Programming1.21 A Simple Program: Printing a Line of Text1.22 Another Simple Program: Adding Two Integers1.23 Memory Concepts1.24 Arithmetic1.25 Decision Making: Equality and Relational Operators1.26 Thinking About Objects: Introduction to Object Technology and the Unified Modeling Language
Outline 2.1 Introduction 2.2 Algorithms 2.3 Pseudocode 2.4 Control Structures 2.5 if Selection Structure 2.6 if/else Selection Structure 2.7 while Repetition Structure 2.8 Formulating Algorithms: Case Study 1 (Counter-Controlled Repetition) 2.9 Formulating Algorithms with Top-Down, Stepwise Refinement: Case Study 2 (Sentinel-Controlled Repetition) 2.10 Formulating Algorithms with Top-Down, Stepwise Refinement: Case Study 3 (Nested Control Structures) 2.11 Assignment Operators 2.12 Increment and Decrement Operators 2.13 Essentials of Counter-Controlled Repetition 2.14 for Repetition Structure 2.15 Examples Using the for Structure Chapter 2 - Control Structures
Chapter 2 - Control Structures Outline 2.16 switch Multiple-Selection Structure 2.17 do/while Repetition Structure 2.18 break and continue Statements 2.19 Logical Operators 2.20 Confusing Equality (==) and Assignment (=) Operators 2.21 Structured-Programming Summary
Chapter 3 - Functions Outline 3.1 Introduction 3.2 Program Components in C++ 3.3 Math Library Functions 3.4 Functions 3.5 Function Definitions 3.6 Function Prototypes 3.7 Header Files 3.8 Random Number Generation 3.9 Example: A Game of Chance and Introducing enum 3.10 Storage Classes 3.11 Scope Rules 3.12 Recursion 3.13 Example Using Recursion: The Fibonacci Series 3.14 Recursion vs. Iteration 3.15 Functions with Empty Parameter Lists
Chapter 3 - Functions Outline3.16 Inline Functions3.17 References and Reference Parameters3.18 Default Arguments 3.19 Unary Scope Resolution Operator3.20 Function Overloading 3.21 Function Templates
Chapter 4 - Arrays Outline 4.1 Introduction4.2 Arrays 4.3 Declaring Arrays 4.4 Examples Using Arrays 4.5 Passing Arrays to Functions 4.6 Sorting Arrays 4.7 Case Study: Computing Mean, Median and Mode Using Arrays 4.8 Searching Arrays: Linear Search and Binary Search 4.9 Multiple-Subscripted Arrays
Chapter 5 - Pointers and Strings Outline5.1 Introduction5.2 Pointer Variable Declarations and Initialization5.3 Pointer Operators5.4 Calling Functions by Reference5.5 Using const with Pointers5.6 Bubble Sort Using Pass-by-Reference5.7 Pointer Expressions and Pointer Arithmetic5.8 Relationship Between Pointers and Arrays5.9 Arrays of Pointers5.10 Case Study: Card Shuffling and Dealing Simulation5.11 Function Pointers5.12 Introduction to Character and String Processing 5.12.1 Fundamentals of Characters and Strings 5.12.2 String Manipulation Functions of the String- Handling Library
Chapter 6: Classes andData Abstraction Outline6.1 Introduction6.2 Structure Definitions6.3 Accessing Structure Members6.4 Implementing a User-Defined Type Time with a struct6.5 Implementing a Time Abstract Data Type with a class6.6 Class Scope and Accessing Class Members6.7 Separating Interface from Implementation6.8 Controlling Access to Members6.9 Access Functions and Utility Functions6.10 Initializing Class Objects: Constructors6.11 Using Default Arguments with Constructors6.12 Destructors6.13 When Constructors and Destructors Are Called6.14 Using Set and Get Functions6.15 Subtle Trap: Returning a Reference to a private Data Member6.16 Default Memberwise Assignment6.17 Software Reusability
Chapter 7: Classes Part II Outline7.1 Introduction7.2 const (Constant) Objects and const Member Functions7.3 Composition: Objects as Members of Classes7.4 friend Functions and friend Classes7.5 Using the this Pointer7.6 Dynamic Memory Management with Operators new and delete7.7 static Class Members7.8 Data Abstraction and Information Hiding 7.8.1 Example: Array Abstract Data Type 7.8.2 Example: String Abstract Data Type 7.8.3 Example: Queue Abstract Data Type7.9 Container Classes and Iterators7.10 Proxy Classes
Chapter 8 - Operator Overloading Outline 8.1 Introduction 8.2 Fundamentals of Operator Overloading 8.3 Restrictions on Operator Overloading 8.4 Operator Functions as Class Members vs. as friend Functions 8.5 Overloading Stream-Insertion and Stream-Extraction Operators 8.6 Overloading Unary Operators 8.7 Overloading Binary Operators 8.8 Case Study: Array Class 8.9 Converting between Types 8.10 Case Study: A String Class 8.11 Overloading ++ and -- 8.12 Case Study: A Date Class 8.13 Standard Library Classes string and vector
Chapter 9 - Object-Oriented Programming: Inheritance Outline9.1 Introduction9.2 Base Classes and Derived Classes9.3 protected Members9.4 Relationship between Base Classes and Derived Classes9.5 Case Study: Three-Level Inheritance Hierarchy9.6 Constructors and Destructors in Derived Classes9.7 “Uses A” and “Knows A” Relationships9.8 public, protected and private Inheritance9.9 Software Engineering with Inheritance
Chapter 10 - Object-Oriented Programming: Polymorphism Outline 10.1 Introduction 10.2 Relationships Among Objects in an Inheritance Hierarchy 10.2.1 Invoking Base-Class Functions from Derived-Class Objects 10.2.2 Aiming Derived-Class Pointers at Base-Class Objects 10.2.3 Derived-Class Member-Function Calls via Base-Class Pointers 10.2.4 Virtual Functions 10.3 Polymorphism Examples 10.4 Type Fields and switch Structures 10.5 Abstract Classes 10.6 Case Study: Inheriting Interface and Implementation 10.7 Polymorphism, Virtual Functions and Dynamic Binding “Under the Hood” 10.8 Virtual Destructors
Chapter 11 - Templates Outline11.1 Introduction11.2 Function Templates11.3 Overloading Function Templates11.4 Class Templates11.5 Class Templates and Nontype Parameters11.6 Templates and Inheritance11.7 Templates and Friends11.8 Templates and static Members
Chapter 12 - C++ Stream Input/Output Outline 12.1 Introduction 12.2 Streams 12.2.1 Classic Streams vs. Standard Streams 12.2.2 iostream Library Header Files 12.2.3 Stream Input/Output Classes and Objects 12.3 Stream Output 12.3.1 Output of char * Variables 12.3.2 Character Output using Member Function put 12.4 Stream Input 12.4.1 get and getline Member Functions 12.4.2 istream Member Functions peek, putback and ignore 12.4.3 Type-Safe I/O 12.5 Unformatted I/O using read, write and gcount
Chapter 12 - C++ Stream Input/Output Outline 12.6 Introduction to Stream Manipulators 12.6.1 Integral Stream Base: dec, oct, hex and setbase 12.6.2 Floating-Point Precision (precision, setprecision) 12.6.3 Field Width (width, setw) 12.6.4 Programmer-Defined Manipulators 12.7 Stream Format States and Stream Manipulators 12.7.1 Trailing Zeros and Decimal Points (showpoint) 12.7.2 Justification (left, right and internal) 12.7.3 Padding (fill, setfill) 12.7.4 Integral Stream Base (dec, oct, hex, showbase) 12.7.5 Floating-Point Numbers; Scientific and Fixed Notation (scientific, fixed) 12.7.6 Uppercase/Lowercase Control (uppercase) 12.7.7 Specifying Boolean Format (boolalpha) 12.7.8 Setting and Resetting the Format State via Member-Function flags 12.8 Stream Error States 12.9 Tying an Output Stream to an Input Stream
Chapter 13 - Exception Handling Outline 13.1 Introduction 13.2 Exception-Handling Overview 13.3 Other Error-Handling Techniques 13.4 Simple Exception-Handling Example: Divide by Zero 13.5 Rethrowing an Exception 13.6 Exception Specifications 13.7 Processing Unexpected Exceptions 13.8 Stack Unwinding 13.9 Constructors, Destructors and Exception Handling 13.10 Exceptions and Inheritance 13.11 Processing new Failures 13.12 Class auto_ptr and Dynamic Memory Allocation 13.13 Standard Library Exception Hierarchy
Chapter 14 - File Processing Outline 14.1 Introduction 14.2 The Data Hierarchy 14.3 Files and Streams 14.4 Creating a Sequential-Access File 14.5 Reading Data from a Sequential-Access File 14.6 Updating Sequential-Access Files 14.7 Random-Access Files 14.8 Creating a Random-Access File 14.9 Writing Data Randomly to a Random-Access File 14.10 Reading Data Sequentially from a Random-Access File 14.11 Example: A Transaction-Processing Program 14.12 Input/Output of Objects
Chapter 15 - Class string and String Stream Processing Outline 15.1 Introduction 15.2 string Assignment and Concatenation 15.3 Comparing strings 15.4 Substrings 15.5 Swapping strings 15.6 string Characteristics 15.7 Finding Strings and Characters in a string 15.8 Replacing Characters in a string 15.9 Inserting Characters into a string 15.10 Conversion to C-Style char * Strings 15.11 Iterators 15.12 String Stream Processing
Chapter 16 - Web Programming with CGI Outline 16.1 Introduction 16.2 HTTP Request Types 16.3 Multi-Tier Architecture 16.4 Accessing Web Servers 16.5 Apache HTTP Server 16.6 Requesting XHTML Documents 16.7 Introduction to CGI 16.8 Simple HTTP Transaction 16.9 Simple CGI Script 16.10 Sending Input to a CGI Script 16.11 Using XHTML Forms to Send Input 16.12 Other Headers 16.13 Case Study: An Interactive Web Page 16.14 Cookies 16.15 Server-Side Files 16.16 Case Study: Shopping Cart 16.17 Internet and Web Resources
Chapter 17 - Data Structures Outline 17.1 Introduction 17.2 Self-Referential Classes 17.3 Dynamic Memory Allocation and Data Structures 17.4 Linked Lists 17.5 Stacks 17.6 Queues 17.7 Trees
Chapter 18 - Bits, Characters, Strings and Structures Outline 18.1 Introduction 18.2 Structure Definitions 18.3 Initializing Structures 18.4 Using Structures with Functions 18.5 typedef 18.6 Example: High-Performance Card-Shuffling and Dealing Simulation 18.7 Bitwise Operators 18.8 Bit Fields 18.9 Character-Handling Library 18.10 String-Conversion Functions 18.11 Search Functions of the String-Handling Library 18.12 Memory Functions of the String-Handling Library
Chapter 19 - The Preprocessor Outline 19.1 Introduction 19.2 The #include Preprocessor Directive 19.3 The #define Preprocessor Directive: Symbolic Constants 19.4 The #define Preprocessor Directive: Macros 19.5 Conditional Compilation 19.6 The #error and #pragma Preprocessor Directives 19.7 The # and ## Operators 19.8 Line Numbers 19.9 Predefined Symbolic Constants 19.10 Assertions
Chapter 20 - C Legacy Code Topics Outline 20.1 Introduction 20.2 Redirecting Input/Output on UNIX and DOS Systems 20.3 Variable-Length Argument Lists 20.4 Using Command-Line Arguments 20.5 Notes on Compiling Multiple-Source-File Programs 20.6 Program Termination with exit and atexit 20.7 The volatile Type Qualifier 20.8 Suffixes for Integer and Floating-Point Constants 20.9 Signal Handling 20.10 Dynamic Memory Allocation with calloc and realloc 20.11 The Unconditional Branch: goto 20.12 Unions 20.13 Linkage Specifications
Chapter 21 - Standard Template Library (STL) Outline 21.1 Introduction to the Standard Template Library (STL) 21.1.1 Introduction to Containers 21.1.2 Introduction to Iterators 21.1.3 Introduction to Algorithms 21.2 Sequence Containers 21.2.1 vector Sequence Container 21.2.2 list Sequence Container 21.2.3 deque Sequence Container 21.3 Associative Containers 21.3.1 multiset Associative Container 21.3.2 set Associative Container 21.3.3 multimap Associative Container 21.3.4 map Associative Container 21.4 Container Adapters 21.4.1 stack Adapter 21.4.2 queue Adapter 21.4.3 priority_queue Adapter
Chapter 21 - Standard Template Library (STL) 21.5 Algorithms 21.5.1 fill, fill_n, generate and generate_n 21.5.2 equal, mismatch and lexicographical_compare 21.5.3 remove, remove_if, remove_copy and remove_copy_if 21.5.4 replace, replace_if, replace_copy and replace_copy_if 21.5.5 Mathematical Algorithms 21.5.6 Basic Searching and Sorting Algorithms 21.5.7 swap, iter_swap and swap_ranges 21.5.8 copy_backward, merge, unique and reverse 21.5.9 inplace_merge, unique_copy and reverse_copy 21.5.10 Set Operations 21.5.11 lower_bound, upper_bound and equal_range 21.5.12 Heapsort 21.5.13 min and max 21.5.14 Algorithms Not Covered in This Chapter 21.6 Class bitset 21.7 Function Objects
Chapter 22 - Other Topics Outline 22.1 Introduction 22.2 const_cast Operator 22.3 reinterpret_cast Operator 22.4 namespaces 22.5 Operator Keywords 22.6 explicit Constructors 22.7 mutable Class Members 22.8 Pointers to Class Members (.* and ->*) 22.9 Multiple Inheritance 22.10 Multiple Inheritance and virtual Base Classes