Formatted contents note |
1 Introduction to Computers, the Internet and the Web<br/>1.1 Introduction<br/>1.2 Computers: Hardware and Software<br/>1.3 Computer Organization<br/>1.4 Personal, Distributed and Client/Server Computing<br/>1.5 The Internet and the World Wide Web<br/>1.6 Machine Languages, Assembly Languages and High-Level Languages<br/>1.7 History of C<br/>1.8 C Standard Library<br/>1.9 C++<br/>1.10 Java<br/>1.11 Fortran, COBOL, Pascal and Ada<br/>1.12 BASIC, Visual Basic, Visual C++, C# and .NET<br/>1.13 Key Sofhvare Trend: Object Technology<br/>1.14 Typical C Program Development Environment<br/>1.15 Hardware Trends<br/>1.16 Notes About C and This Book<br/>1.17 Web Resources<br/>2 Introduction to C Programming<br/>2.1 Introduction<br/>2.2 A Simple C Program: Printing a Line of Text<br/>2.3 Another Simple C Program: Adding Two Integers<br/>2.4 Memory Concepts<br/>2.5 Arithmetic in C<br/>2.6 Decision Making: Equality and Relational Operators<br/>3 Structured Program Development In C<br/>3.1 Introduction<br/>3.2 Algorithms<br/>3.3 Pseudocode<br/>3.4 Control Structures<br/>3.5 The i f Selection Statement<br/>3.6 The i f.. .el se Selection Statement<br/>3.7 The whi 1 e Repetition Statement<br/>3.8 Formulating Algorithms Case Study 1: Counter-Controlled Repetition<br/>3.9 Formulating Algorithms with Top-Down, Stepwise Refinement<br/>Case Study 2: Sentinel-Controlled Repetition<br/>3.10 Formulating Algorithms with Top-Down, Stepwise Refinement<br/>Case Study 3: Nested Control Structures<br/>3.11 Assignment Operators<br/>3.12 Increment and Decrement Operators<br/>4 C Program Control<br/>4.1 Introduction<br/>4.2 Repetition Essentials<br/>4.3 Counter-Controlled Repetition<br/>4.4 for Repetition Statement<br/>4.5 for Statement: Notes and Observations<br/>4.6 Examples Using the for Statement<br/>4.7 switch Multiple-Selection Statement<br/>4.8 do...whi 1 e Repetition Statement<br/>4.9 break and continue Statements<br/>4.10 Logical Operators<br/>4.11 Confusing Equality (=) and Assignment (=) Operators<br/>4.12 Structured Programming Summary<br/>5 C Functions<br/>5.1 Introduction<br/>5.2 Program Modules in C<br/>5.3 Math Library Fimctions<br/>5.4 Functions<br/>5.5 Function Definitions<br/>5.6 Function Prototypes<br/>5.7 Function Call Stack and Activation Records<br/>5.8 Headers<br/>5.9 Calling Functions By Value and By Reference<br/>5.10 Random Number Generation<br/>5.11 Example: A Game of Chance<br/>5.12 Storage Classes<br/>5.13 Scope Rules<br/>5.14 Recursion<br/>5.15 Example Using Recursion: Fibonacci Series<br/>5.16 Recursion vs. Iteration<br/>6 C Arrays<br/>6.1 Introduction<br/>6.2 Arrays<br/>6.3 Defining Arrays<br/>6.4 Array Examples<br/>6.5 Passing Arrays to Functions<br/>6.6 Sorting Arrays<br/>6.7 Case Study: Computing Mean, Median and Mode Using Arrays<br/>6.8 Searching Arrays<br/>6.9 Multiple-Subscripted Arrays<br/>7 C Pointers<br/>7.1 Introduction<br/>7.2 Pointer Variable Definitions and Initialization<br/>7.3 Pointer Operators<br/>7.4 Passing Arguments to Functions by Reference<br/>7.5 Using the const Qualifier with Pointers<br/>7^6 Bubble Sort Using Call-by-Reference<br/>7.7 si zeof Operator<br/>y g Pointer Expressions and Pointer Arithmetic<br/>7.9 Relationship between Pointers and Arrays<br/>7.10 Arrays of Pointers . o . •<br/>7.11 Case Study: Card Shuffling and Dealing Simulation<br/>7.12 Pointers to Functions<br/>8 C Characters and Strings<br/>8.1 Introduction<br/>8.2 Fundamentals of Strings and Characters<br/>8.3 Character-Handling Libr^<br/>8 4 String-Conversion Functions<br/>8^5 Standard Input/Output Library Functions<br/>8 6 String-Manipulation Functions of the String-Handling Library<br/>87 Comparison Functions of the String-Handling Library<br/>8.8 Search Functions of the String-Handling Library<br/>8!9 Memory Functions of the String-Handling Library<br/>8.10 Other Functions of the String-Handling Library<br/>9 C Formatted Input/Output<br/>9.1 Introduction<br/>9.2 Streams<br/>9.3 Formatting Output with pri ntf<br/>9.4 Printing Integers<br/>9.5 Printing Floating-Point Numbers<br/>9.6 Printing Strings and Characters<br/>9.7 Other Conversion Specifiers<br/>9.8 Printing with Field Widths and Precision<br/>9.9 Using Flags in the printf Format Control String<br/>9.10 Printing Literals and Escape Sequences<br/>9.11 Reading Formatted Input with scanf<br/>10 C Structures, Unions, Bit Manipulations and<br/>Enumerations<br/>10.1 Introduction<br/>10.2 Structure Definitions<br/>10.3 Initializing Structures<br/>10.4 Accessing Structure Members<br/>10.5 Using Structures with Functions<br/>10.6 typedef<br/>10.7 Fjcample: High-Performance Card Shuffling and Dealing Simulation<br/>10.8 Unions<br/>10.9 Bitwise Operators<br/>10.10 Bit Fields<br/>10.11 Enumeration Constants<br/>I I C File Processing<br/>11.1 Introduction<br/>11.2 Data Hierarchy<br/>11.3 Files and Streams<br/>11.4 Creating a Sequential-Access File<br/>11.5 Reading Data from a Sequential-Access File<br/>11.6 Random-Access Files<br/>11.7 Creating a Random-Access File<br/>11.8 Writing Data Randomly to a Random-Access File<br/>11.9 Reading Data from a Random-Access File<br/>11.10 Case Study: Transaction-Processing Program<br/>12 C Data Structures<br/>12.1 Introduction<br/>12.2 Self-Referential Structures<br/>12.3 Dynamic Memory Allocation<br/>12.4 Linked Lists<br/>12.5 Stacks<br/>12.6 Queues<br/>12.7 Trees<br/>13 C Preprocessor<br/>13.1 Introduaion<br/>13.2 #include Preprocessor Directive<br/>13.3 #define Preprocessor Directive: Symbolic Constants<br/>13.4 #define Preprocessor Directive: Macros<br/>13.5 Conditional Compilation<br/>13.6 #error and #pragnia Preprocessor Directives<br/>13.7 # and ## Operators<br/>13.8 Line Numbers<br/>13.9 Predefined Symbolic Constants<br/>13.10 Assertions<br/>14 other C Topics<br/>14.1 Introduction<br/>14.2 Redirecting I/O<br/>14.3 Variable-Length Argument Lists<br/>14.4 Using Command-Line Arguments<br/>14.5 Notes on Compiling Multiple-Source-File Programs<br/>14.6 Program Termination with exit and atexit<br/>14.7 vol ati 1 e Type Qualifier<br/>14.8 Suffixes for Integer and Floating-Point Constants<br/>14.9 More on Files<br/>14.10 Signal Handling<br/>14.11 Dynamic Memory Allocation: Functions calloc and real 1 oc<br/>14.12 Unconditional Branching with goto<br/>15 C++ as a Better C; Introducing<br/>Object Technology<br/>15.1 Introduction<br/>15.2 C++<br/>15.3 A Simple Program: Adding Two Integers<br/>15.4 C++ Standard Library<br/>15.5 Header Files<br/>15.6 Inline Functions<br/>15.7 References and Reference Parameters<br/>15.8 Empty Parameter Lists<br/>15.9 Default Arguments<br/>15.10 Unary Scope Resolution Operator<br/>15.11 Function Overloading<br/>15.12 Function Templates<br/>15.13 Introduction to Object Technology and the UML<br/>15.14 Wrap-Up<br/>16 Introduction to Classes and Objects<br/>16.1 Introduction<br/>16.2 Classes, Objects, Member Functions and Data Members<br/>16.3 Defining a Class with a Member Function<br/>16.4 Defining a Member Function with a Parameter<br/>16.5 Dau Members, set Functions and get Functions<br/>16.6 Initializing Objects with Constructors<br/>16.7 Placing a Class in a Separate File for Reusability<br/>16.8 Separating Interfiice from Implementation<br/>16.9 Validating Data with rer Functions<br/>16.10 Wrap-Up<br/>I 7 Classes: A Deeper Look, Part 1<br/>17.1 Introduction<br/>17.2 Time Class Case Study<br/>17.3 Class Scope and Accessing Class Members<br/>17.4 Separating Inter&ce from Implementation<br/>17.5 Access Functions and Utility Functions<br/>17.6 Time Class Case Study: Constructors with Default Arguments<br/>17.7 Destructors<br/>17.8 When Constructors and Destructors are Called<br/>17.9 Time Class Case Study: A Subtle Trap—Returning a Reference to a<br/>private Data Member<br/>17.10 Default Memberwise Assignment<br/>17.11 Wrap-Up<br/>18 Classes: A Deeper Look, Part 2<br/>18.1 Introduction<br/>18.2 const (Constant) Objects and const Member Functions<br/>18.3 Composition: Objects as Members of Classes<br/>18.4 f ri end Functions and f ri end Classes<br/>18.5 Using the thi s Pointer<br/>18.6 static Class Members<br/>18.7 Data Abstraction and Information Hiding<br/>18.8 Wrap-Up<br/>19 Operator Overloading<br/>19.1 Introduction<br/>19.2 Fundamentals of Operator Overloading<br/>19.3 Restrictions on Operator Overloading<br/>19.4 Operator Functions as Class Members vs. Global Function<br/>19.5 Overloading Stream Insertion and Stream Extraction Operators<br/>19.6 Overloading Unary Operators<br/>19.7 Overloading Binary Operators<br/>19.8 Dynamic Memory Management<br/>19.9 Case Study: Array Class<br/>19.10 Converting betw^n T)^es<br/>19.11 Building a String Class<br/>19.12 Overloading ++ and —<br/>19.13 Case Study. A Date Class<br/>19.14 Standard Library Class string<br/>19.15 explicit Constructors<br/>19.16 Proxy Classes<br/>19.17 Wrap-Up<br/>20 Object-Oriented Programming: Inheritance<br/>20.1 Introduction<br/>20.2 Base Classes and Derived Classes<br/>20.3 protected Members<br/>20.4 Relationship between Base Classes and Derived Classes<br/>20.4.1 Creating and Using a Commi ssi onEmpl oyee Class<br/>20.4.2 Creating a BasePlusCommi ssi onEmpl oyee Class Without<br/>Using Inheritance<br/>20.4.3 Creating a Commi ssi onEmpl oyee-BasePlusCommi ssi onEmpl oyet<br/>Inheritance Hierarchy<br/>20.4.4 Commi ssi onEmployee-BasePlusCommi ssi onEmployee<br/>Inheritance Hierarchy Using protected Data<br/>20.4.5 Commi ssi onEmployee-BasePiusCommi ssi onEmployee<br/>Inheritance Hierarchy Using private Data<br/>20.5 Constructors and Destructors in Derived Classes<br/>20.6 publ i c, protected and pri vate Inheritance<br/>20.7 Software Engineering with Inheritance<br/>20.8 Wrap-Up<br/>21 Object-Oriented Programming: Polymorphism<br/>21.1 Introduction<br/>21.2 Polymorphism Examples<br/>21.3 Relationships Among Objects in an Inheritance Hierarchy<br/>21.3.1 Invoking Base-Class Functions from Derived-Class Objects<br/>21.3.2 Aiming Derived-Class Pointers at Base-Class Objects<br/>21.3.3 Derived-Class Member-Fimction Calls via Base-Class Pointers<br/>21.3.4 Virtual Functions<br/>21.3.5 Summary of the Allowed Assignments Between Base-Class<br/>and Derived-Class Objects and Pointers<br/>21.4 Type Fields and swi tch Statements<br/>21.5 Abstract Classes and Pure vi rtual Functions<br/>21.6 Case Study: Payroll System Using Polymorphism<br/>21.6.1 Creating Abstract Base Class Empl oyee<br/>21.6.2 Creating Concrete Derived Class Sal an" edEmpl oyee<br/>21.6.3 Creating Concrete Derived Class Hou rl y Empl oyee<br/>21.6.4 Creating Concrete Derived Class Commi ssi onEmpl oyee<br/>21.6.5 Creating Indirect Concrete Derived Class<br/>BasePI usComtni ssi onEmpI oyee<br/>21.6.6 Demonstrating Polymorphic Processing<br/>21.7 (Optional) Polymorphism, Virtual Functions and Dynamic Binding<br/>"Under the Hood"<br/>21.8 Case Study: Payroll System Using Polymorphism and Runtime Type<br/>Information with Downcasting, dynami c_cast, typeid and type_info<br/>21.9 Virtual Destructors<br/>21.10 Wrap-Up<br/>22 Templates<br/>22.1 Introduction<br/>22.2 Function Templates<br/>22.3 Overloading Function Templates<br/>22.4 Class Templates<br/>22.5 Nontype Parameters and Default Types for Class Templates<br/>22.6 Notes on Templates and Inheritance<br/>22.7 Notes on Templates and Friends<br/>22.8 Notes on Templates and stati c Members<br/>22.9 Wrap-Up<br/>23 Stream Input/Output<br/>23.1 Introduction<br/>23.2 Streams<br/>23.2.1 Classic Streams vs. Standard Streams<br/>23.2.2 iostream Library Header Files<br/>23.2.3 Stream Input/Output Classes and Objects<br/>23.3 Stream Output<br/>23.3.1 Output of char * Variables<br/>23.3.2 Character Output Using Member Function put<br/>23.4 Stream Input<br/>23.4.1 get and get! i ne Member Functions<br/>23.4.2 i stream Member Functions peek, putback and i gnore<br/>23.4.3 Type-Safe I/O<br/>23.5 Unformatted I/O Using read, write and gcount<br/>23.6 Introduction to Stream Manipulators<br/>23.6.1 Integral Stream Base: dec, oct, hex and setbase<br/>23.6.2 Floating-Point Precision (preci si on, setpreci si on)<br/>23.6.3 Field Width (width, setw)<br/>23.6.4 User-Defined Output Stream Manipulators<br/>23.7 Stream Format States and Stream Manipulators<br/>23.7.1 Trailing Zeros and Decimal Points (showpoi nt)<br/>23.7.2 Justification (left, right and internal)<br/>23.7.3 Padding (f i 11, setf i 11)<br/>23.7.4 Integral Stream Base (dec, oct, hex, showbase)<br/>23.7.5 Floating-Point Numbers; Scientific and Fixed Notation<br/>(scientific, fixed)<br/>25.7.G Uppercase/Lowercase Control (uppercase)<br/>23.7.7 Specifying Boolean Format (boolalpha)<br/>23.7.8 Setting and Resetting the Format State via Member<br/>Function flags<br/>23.8 Stream Error States<br/>23.9 Tying an Output Stream to an Input Stream<br/>23.10 Wrap-Up<br/>24 Exception Handling<br/>24.1 Introduction<br/>24.2 Exception-Handling Overview<br/>24.3 Example: Handling an Attempt to Divide by Zero<br/>24.4 When to Use Exception Handling<br/>24;5 Rethrowing an Exception<br/>24.6 Exception Specifications<br/>24.7 Processing Unexpected Exceptions<br/>24.8 Stack Unwinding<br/>24.9 Constructors, Destructors and Exception Handling<br/>24.10 Exceptions and Inheritance<br/>24.11 Processing new Failures<br/>24.12 Class auto_ptr and Dynamic Memory Allocation<br/>24.13 Standard Library Exception Hierarchy<br/>24.14 Other Error-Handling Techniques<br/>24.15 Wrap-Up |