C How to Program 8th Edition by Paul Deitel, Harvey Deitel – Ebook PDF Instant Download/Delivery. 0134147308, 9780134147307
Full download C How to Program 8th Edition after payment
Product details:
ISBN 10: 0134147308
ISBN 13: 9780134147307
Author: Paul Deitel, Harvey Deitel
This is the eBook of the printed book and may not include any media, website access codes, or print supplements that may come packaged with the bound book. For courses in computer programming C How to Program is a comprehensive introduction to programming in C. Like other texts of the Deitels’ How to Program series, the book serves as a detailed beginner source of information for college students looking to embark on a career in coding, or instructors and software-development professionals seeking to learn how to program with C. The Eighth Edition continues the tradition of the signature Deitel “Live Code” approach–presenting concepts in the context of full-working programs rather than incomplete snips of code. This gives readers a chance to run each program as they study it and see how their learning applies to real world programming scenarios.
C How to Program 8th Table of contents:
1 Introduction to Computers, the Internet and the Web
Objectives
Outline
1.1 Introduction
1.2 Hardware and Software
1.2.1 Moore’s Law
1.2.2 Computer Organization
1.3 Data Hierarchy
1.4 Machine Languages, Assembly Languages and High-Level Languages
1.5 The C Programming Language
Built for Performance
1.6 C Standard Library
1.7 C++ and Other C-Based Languages
1.8 Object Technology
1.8.1 The Automobile as an Object
1.8.2 Methods and Classes
1.8.3 Instantiation
1.8.4 Reuse
1.8.5 Messages and Method Calls
1.8.6 Attributes and Instance Variables
1.8.7 Encapsulation and Information Hiding
1.8.8 Inheritance
1.9 Typical C Program-Development Environment
1.9.1 Phase 1: Creating a Program
1.9.2 Phases 2 and 3: Preprocessing and Compiling a C Program
1.9.3 Phase 4: Linking
1.9.4 Phase 5: Loading
1.9.5 Phase 6: Execution
1.9.6 Problems That May Occur at Execution Time
1.9.7 Standard Input, Standard Output and Standard Error Streams
1.10 Test-Driving a C Application in Windows, Linux and Mac OS X
1.10.1 Running a C Application from the Windows Command Prompt
1.10.2 Running a C Application Using GNU C with Linux
1.10.3 Running a C Application Using the Teminal on Mac OS X
1.11 Operating Systems
1.11.1 Windows—A Proprietary Operating System
1.11.2 Linux—An Open-Source Operating System
1.11.3 Apple’s Mac OS X; Apple’s iOS for iPhone®, iPad® and iPod Touch® Devices
1.11.4 Google’s Android
1.12 The Internet and World Wide Web
1.12.1 The Internet: A Network of Networks
1.12.2 The World Wide Web: Making the Internet User-Friendly
1.12.3 Web Services
1.12.4 Ajax
1.12.5 The Internet of Things
1.13 Some Key Software Terminology
1.14 Keeping Up-to-Date with Information Technologies
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
Making a Difference
2 Introduction to C Programming
Objectives
Outline
2.1 Introduction
2.2 A Simple C Program: Printing a Line of Text
2.3 Another Simple C Program: Adding Two Integers
2.4 Memory Concepts
2.5 Arithmetic in C
2.6 Decision Making: Equality and Relational Operators
2.7 Secure C Programming
Summary
Section 2.1 Introduction
Section 2.2 A Simple C Program: Printing a Line of Text
Section 2.3 Another Simple C Program: Adding Two Integers
Section 2.4 Memory Concepts
Section 2.5 Arithmetic in C
Section 2.6 Decision Making: Equality and Relational Operators
Section 2.7 Secure C Programming
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
Making a Difference
3 Structured Program Development in C
Objectives
Outline
3.1 Introduction
3.2 Algorithms
3.3 Pseudocode
3.4 Control Structures
3.5 The if Selection Statement
3.6 The if …else Selection Statement
3.7 The while Iteration Statement
3.8 Formulating Algorithms Case Study 1: Counter-Controlled Iteration
3.9 Formulating Algorithms with Top-Down, Stepwise Refinement Case Study 2: Sentinel-Controlled Iteration
3.10 Formulating Algorithms with Top-Down, Stepwise Refinement Case Study 3: Nested Control Statements
3.11 Assignment Operators
3.12 Increment and Decrement Operators
3.13 Secure C Programming
Summary
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
Making a Difference
4 C Program Control
Objectives
Outline
4.1 Introduction
4.2 Iteration Essentials
4.3 Counter-Controlled Iteration
4.4 for Iteration Statement
4.5 for Statement: Notes and Observations
4.6 Examples Using the for Statement
4.7 switch Multiple-Selection Statement
4.8 do…while Iteration Statement
4.9 break and continue Statements
4.10 Logical Operators
4.11 Confusing Equality (==) and Assignment (=) Operators
4.12 Structured Programming Summary
4.13 Secure C Programming
Checking Function scanf’s Return Value
Range Checking
Summary
Section 4.2 Iteration Essentials
Section 4.3 Counter-Controlled Iteration.
Section 4.4 for Iteration Statement
Section 4.5 for Statement: Notes and Observations
Section 4.6 Examples Using the for Statement
Section 4.7 switch Multiple-Selection Statement
Section 4.8 do…while Iteration Statement
Section 4.9 break and continue Statements
Section 4.10 Logical Operators.
Section 4.11 Confusing Equality (==) and Assignment (=) Operators.
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
Making a Difference
5 C Functions
Objectives
Outline
5.1 Introduction
5.2 Modularizing Programs in C
5.3 Math Library Functions
5.4 Functions
5.5 Function Definitions
5.5.1 square Function
Calling Function square
square Function Definition
square Function Prototype
Format of a Function Definition
Function Body
Returning Control from a Function
main’s Return Type
5.5.2 maximum Function
5.6 Function Prototypes: A Deeper Look
5.7 Function Call Stack and Stack Frames
5.8 Headers
5.9 Passing Arguments By Value and By Reference
5.10 Random Number Generation
5.11 Example: A Game of Chance; Introducing enum
5.12 Storage Classes
5.13 Scope Rules
5.14 Recursion
5.15 Example Using Recursion: Fibonacci Series
5.16 Recursion vs. Iteration
5.17 Secure C Programming
Summary
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
Making a Difference
6 C Arrays
Objectives
Outline
6.1 Introduction
6.2 Arrays
6.3 Defining Arrays
6.4 Array Examples
6.4.1 Defining an Array and Using a Loop to Set the Array’s Element Values
6.4.2 Initializing an Array in a Definition with an Initializer List
6.4.3 Specifying an Array’s Size with a Symbolic Constant and Initializing Array Elements with Calculations
6.4.4 Summing the Elements of an Array
6.4.5 Using Arrays to Summarize Survey Results
6.4.6 Graphing Array Element Values with Histograms
6.4.7 Rolling a Die 60,000,000 Times and Summarizing the Results in an Array
6.5 Using Character Arrays to Store and Manipulate Strings
6.5.1 Initializing a Character Array with a String
6.5.2 Initializing a Character Array with an Intializer List of Characters
6.5.3 Accessing the Characters in a String
6.5.4 Inputting into a Character Array
6.5.5 Outputting a Character Array That Represents a String
6.5.6 Demonstrating Character Arrays
6.6 Static Local Arrays and Automatic Local Arrays
6.7 Passing Arrays to Functions
6.8 Sorting Arrays
6.9 Case Study: Computing Mean, Median and Mode Using Arrays
6.10 Searching Arrays
6.10.1 Searching an Array with Linear Search
6.10.2 Searching an Array with Binary Search
6.11 Multidimensional Arrays
6.11.1 Illustrating a Double-Subcripted Array
6.11.2 Initializing a Double-Subcripted Array
array1 Definition
array2 Definition
array3 Definition
printArray Function
6.11.3 Setting the Elements in One Row
6.11.4 Totaling the Elements in a Two-Dimensional Array
6.11.5 Two-Dimensonal Array Manipulations
6.12 Variable-Length Arrays2
6.13 Secure C Programming
Summary
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
Recursion Exercises
7 C Pointers
Objectives
Outline
7.1 Introduction
7.2 Pointer Variable Definitions and Initialization
7.3 Pointer Operators
7.4 Passing Arguments to Functions by Reference
7.5 Using the const Qualifier with Pointers
7.5.1 Converting a String to Uppercase Using a Non-Constant Pointer to Non-Constant Data
7.5.2 Printing a String One Character at a Time Using a Non-Constant Pointer to Constant Data
7.5.3 Attempting to Modify a Constant Pointer to Non-Constant Data
7.5.4 Attempting to Modify a Constant Pointer to Constant Data
7.6 Bubble Sort3 Using Pass-by-Reference
7.7 sizeof Operator
7.8 Pointer Expressions and Pointer Arithmetic
7.8.1 Allowed Operators for Pointer Arithmetic
7.8.2 Aiming a Pointer at an Array
7.8.3 Adding an Integer to a Pointer
7.8.4 Subtracting an Integer from a Pointer
7.8.5 Incrementing and Decrementing a Pointer
7.8.6 Subtracting One Pointer from Another
7.8.7 Assigning Pointers to One Another
7.8.8 Pointer to void
7.8.9 Comparing Pointers
7.9 Relationship between Pointers and Arrays
7.9.1 Pointer/Offset Notation
7.9.2 Pointer/Index Notation
7.9.3 Cannot Modify an Array Name with Pointer Arithmetic
7.9.4 Demonstrating Pointer Indexing and Offsets
7.9.5 String Copying with Arrays and Pointers
Copying with Array Index Notation
Copying with Pointers and Pointer Arithmetic
Notes Regarding Functions copy1 and copy2
7.10 Arrays of Pointers
7.11 Case Study: Card Shuffling and Dealing Simulation
7.12 Pointers to Functions
7.12.1 Sorting in Ascending or Descending Order
7.12.2 Using Function Pointers to Create a Menu-Driven System
7.13 Secure C Programming
Summary
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
Special Section: Building Your Own Computer
Array of Function Pointer Exercises
Making a Difference
8 C Characters and Strings
Objectives
Outline
8.1 Introduction
8.2 Fundamentals of Strings and Characters
8.3 Character-Handling Library
8.3.1 Functions isdigit, isalpha, isalnum and isxdigit
8.3.2 Functions islower, isupper, tolower and toupper
8.3.3 Functions isspace, iscntrl, ispunct, isprint and isgraph
8.4 String-Conversion Functions
8.4.1 Function strtod
8.4.2 Function strtol
8.4.3 Function strtoul
8.5 Standard Input/Output Library Functions
8.5.1 Functions fgets and putchar
8.5.2 Function getchar
8.5.3 Function sprintf
8.5.4 Function sscanf
8.6 String-Manipulation Functions of the String-Handling Library
8.6.1 Functions strcpy and strncpy
8.6.2 Functions strcat and strncat
8.7 Comparison Functions of the String-Handling Library
8.8 Search Functions of the String-Handling Library
8.8.1 Function strchr
8.8.2 Function strcspn
8.8.3 Function strpbrk
8.8.4 Function strrchr
8.8.5 Function strspn
8.8.6 Function strstr
8.8.7 Function strtok
8.9 Memory Functions of the String-Handling Library
8.9.1 Function memcpy
8.9.2 Function memmove
8.9.3 Function memcmp
8.9.4 Function memchr
8.9.5 Function memset
8.10 Other Functions of the String-Handling Library
8.10.1 Function strerror
8.10.2 Function strlen
8.11 Secure C Programming
Summary
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
Special Section: Advanced String-Manipulation Exercises
A Challenging String-Manipulation Project
Making a Difference
9 C Formatted Input/Output
Objectives
Outline
9.1 Introduction
9.2 Streams
9.3 Formatting Output with printf
9.4 Printing Integers
9.5 Printing Floating-Point Numbers
9.5.1 Conversion Specifiers e, E and f
9.5.2 Conversion Specifiers g and G
9.5.3 Demonstrating Floating-Point Conversion Specifiers
9.6 Printing Strings and Characters
9.7 Other Conversion Specifiers
9.8 Printing with Field Widths and Precision
9.8.1 Specifying Field Widths for Printing Integers
9.8.2 Specifying Precisions for Integers, Floating-Point Numbers and Strings
9.8.3 Combining Field Widths and Precisions
9.9 Using Flags in the printf Format Control String
9.9.1 Right and Left Justification
9.9.2 Printing Positive and Negative Numbers with and without the + Flag
9.9.3 Using the Space Flag
9.9.4 Using the # Flag
9.9.5 Using the 0 Flag
9.10 Printing Literals and Escape Sequences
9.11 Reading Formatted Input with scanf
9.11.1 scanf Syntax
9.11.2 scanf Conversion Specifiers
9.11.3 Reading Integers with scanf
9.11.4 Reading Floating-Point Numbers with scanf
9.11.5 Reading Characters and Strings with scanf
9.11.6 Using Scan Sets with scanf
9.11.7 Using Field Widths with scanf
9.11.8 Skipping Characters in an Input Stream
9.12 Secure C Programming
Summary
Section 9.2 Streams
Section 9.3 Formatting Output with printf
Section 9.4 Printing Integers
Section 9.5 Printing Floating-Point Numbers
Section 9.6 Printing Strings and Characters
Section 9.7 Other Conversion Specifiers
Section 9.8 Printing with Field Widths and Precision
Section 9.9 Using Flags in the printf Format Control String
Section 9.10 Printing Literals and Escape Sequences
Section 9.11 Reading Formatted Input with scanf
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
10 C Structures, Unions, Bit Manipulation and Enumerations
Objectives
Outline
10.1 Introduction
10.2 Structure Definitions
10.2.1 Self-Referential Structures
10.2.2 Defining Variables of Structure Types
10.2.3 Structure Tag Names
10.2.4 Operations That Can Be Performed on Structures
10.3 Initializing Structures
10.4 Accessing Structure Members with . and ->
10.5 Using Structures with Functions
10.6 typedef
10.7 Example: High-Performance Card Shuffling and Dealing Simulation
10.8 Unions
10.8.1 Union Declarations
10.8.2 Operations That Can Be Performed on Unions
10.8.3 Initializing Unions in Declarations
10.8.4 Demonstrating Unions
10.9 Bitwise Operators
10.9.1 Displaying an Unsigned Integer in Bits
10.9.2 Making Function displayBits More Generic and Portable
10.9.3 Using the Bitwise AND, Inclusive OR, Exclusive OR and Complement Operators
Bitwise AND Operator (&)
Bitwise Inclusive OR Operator (|)
Bitwise Exclusive OR Operator (^)
Bitwise Complement Operator (~)
10.9.4 Using the Bitwise Left- and Right-Shift Operators
Left-Shift Operator (<<)
Right-Shift Operator (>>)
10.9.5 Bitwise Assignment Operators
10.10 Bit Fields
10.10.1 Defining Bit Fields
10.10.2 Using Bit Fields to Represent a Card’s Face, Suit and Color
10.10.3 Unnamed Bit Fields
10.11 Enumeration Constants
10.12 Anonymous Structures and Unions
10.13 Secure C Programming
Summary
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
Making a Difference
11 C File Processing
Objectives
Outline
11.1 Introduction
11.2 Files and Streams
11.3 Creating a Sequential-Access File
11.3.1 Pointer to a FILE
11.3.2 Using fopen to Open the File
11.3.3 Using feof to Check for the End-of-File Indicator
11.3.4 Using fprintf to Write to the File
11.3.5 Using fclose to Close the File
Relationship Betweeen FILE Pointers, FILE Structures and FCBs
11.3.6 File Open Modes
11.4 Reading Data from a Sequential-Access File
11.4.1 Resetting the File Position Pointer
11.4.2 Credit Inquiry Program
Updating a Sequential File
11.5 Random-Access Files
11.6 Creating a Random-Access File
11.7 Writing Data Randomly to a Random-Access File
11.7.1 Positioning the File Position Pointer with fseek
fseek Function Prototype
11.7.2 Error Checking
11.8 Reading Data from a Random-Access File
11.9 Case Study: Transaction-Processing Program
11.10 Secure C Programming
Summary
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
Making a Difference
12 C Data Structures
Objectives
Outline
12.1 Introduction
12.2 Self-Referential Structures
12.3 Dynamic Memory Allocation
12.4 Linked Lists
12.4.1 Function insert
12.4.2 Function delete
12.4.3 Function printList
12.5 Stacks
12.5.1 Function push
12.5.2 Function pop
12.5.3 Applications of Stacks
12.6 Queues
12.6.1 Function enqueue
12.6.2 Function dequeue
12.7 Trees
12.7.1 Function insertNode
12.7.2 Traversals: Functions inOrder, preOrder and postOrder
12.7.3 Duplicate Elimination
12.7.4 Binary Tree Search
12.7.5 Other Binary Tree Operations
12.8 Secure C Programming
Summary
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
Special Section: Building Your Own Compiler
13 C Preprocessor
Objectives
Outline
13.1 Introduction
13.2 #include Preprocessor Directive
13.3 #define Preprocessor Directive: Symbolic Constants
13.4 #define Preprocessor Directive: Macros
13.4.1 Macro with One Argument
Expanding a Macro with an Argument
Importance of Parentheses
Better to Use a Function
13.4.2 Macro with Two Arguments
13.4.3 Macro Continuation Character
13.4.4 #undef Preprocessor Directive
13.4.5 Standard Library Functions and Macros
13.4.6 Do Not Place Expressions with Side Effects in Macros
13.5 Conditional Compilation
13.5.1 #if…#endif Preprocessor Directive
13.5.2 Commenting Out Blocks of Code with #if…#endif
13.5.3 Conditionally Compiling Debugging Code
13.6 #error and #pragma Preprocessor Directives
13.7 # and ## Operators
13.8 Line Numbers
13.9 Predefined Symbolic Constants
13.10 Assertions
13.11 Secure C Programming
Summary
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
14 Other C Topics
Objectives
Outline
14.1 Introduction
14.2 Redirecting I/O
14.2.1 Redirecting Input with <
14.2.2 Redirecting Input with |
14.2.3 Redirecting Output
14.3 Variable-Length Argument Lists
14.4 Using Command-Line Arguments
14.5 Compiling Multiple-Source-File Programs
14.5.1 extern Declarations for Global Variables in Other Files
14.5.2 Function Prototypes
14.5.3 Restricting Scope with static
14.5.4 Makefiles
14.6 Program Termination with exit and atexit
14.7 Suffixes for Integer and Floating-Point Literals
14.8 Signal Handling
14.9 Dynamic Memory Allocation: Functions calloc and realloc
14.10 Unconditional Branching with goto
Summary
Self-Review Exercise
Answers to Self-Review Exercise
Exercises
15 C++ as a Better C; Introducing Object Technology
Objectives
Outline
15.1 Introduction
15.2 C++
15.3 A Simple Program: Adding Two Integers
15.3.1 Addition Program in C++
15.3.2 Header
15.3.3 main Function
15.3.4 Variable Declarations
15.3.5 Standard Output Stream and Standard Input Stream Objects
15.3.6 std::endl Stream Manipulator
15.3.7 std:: Explained
15.3.8 Concatenated Stream Outputs
15.3.9 return Statement Not Required in main
15.3.10 Operator Overloading
15.4 C++ Standard Library
15.5 Header Files
15.6 Inline Functions
15.7 C++ Keywords
15.8 References and Reference Parameters
15.8.1 Reference Parameters
15.8.2 Passing Arguments by Value and by Reference
15.8.3 References as Aliases within a Function
15.8.4 Returning a Reference from a Function
15.8.5 Error Messages for Uninitialized References
15.9 Empty Parameter Lists
15.10 Default Arguments
15.11 Unary Scope Resolution Operator
15.12 Function Overloading
15.13 Function Templates
15.13.1 Defining a Function Template
15.13.2 Using a Function Template
15.14 Introduction to Object Technology and the UML
15.14.1 Basic Object Technology Concepts
Attributes and Behaviors
Object-Oriented Design and Inheritance
Encapsulation and Information Hiding
Object-Oriented Programming
15.14.2 Classes, Data Members and Member Functions
15.14.3 Object-Oriented Analysis and Design
15.14.4 The Unified Modeling Language
15.15 Introduction to C++ Standard Library Class Template vector
15.15.1 Problems Associated with C-Style Pointer-Based Arrays
15.15.2 Using Class Template vector
Creating vector Objects
vector Member Function size; Function outputVector
Function inputVector
Comparing vector Objects for Inequality
Initializing One vector with the Contents of Another
Assigning vectors and Comparing vectors for Equality
Using the [] Operator to Access and Modify vector Elements
15.15.3 Exception Handling: Processing an Out-of-Range Index
The try Statement
Executing the catch Block
what Member Function of the Exception Parameter
Summary of This Example
15.16 Wrap-Up
Summary
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
16 Introduction to Classes, Objects and Strings
Objectives
Outline
16.1 Introduction
16.2 Defining a Class with a Member Function
16.3 Defining a Member Function with a Parameter
16.4 Data Members, set Member Functions and get Member Functions
16.5 Initializing Objects with Constructors
16.6 Placing a Class in a Separate File for Reusability
16.7 Separating Interface from Implementation
16.8 Validating Data with set Functions
16.9 Wrap-Up
Summary
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
Making a Difference
17 Classes: A Deeper Look; Throwing Exceptions
Objectives
Outline
17.1 Introduction
17.2 Time Class Case Study
17.3 Class Scope and Accessing Class Members
17.4 Access Functions and Utility Functions
17.5 Time Class Case Study: Constructors with Default Arguments
17.6 Destructors
17.7 When Constructors and Destructors Are Called
17.8 Time Class Case Study: A Subtle Trap—Returning a Reference or a Pointer to a private Data Member
17.9 Default Memberwise Assignment
17.10 const Objects and const Member Functions
17.11 Composition: Objects as Members of Classes
17.12 friend Functions and friend Classes
Declaring a friend
17.13 Using the this Pointer
17.14 static Class Members
17.15 Wrap-Up
Summary
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
Making a Difference
18 Operator Overloading; Class string
Objectives
Outline
18.1 Introduction
18.2 Using the Overloaded Operators of Standard Library Class string
18.3 Fundamentals of Operator Overloading
18.4 Overloading Binary Operators
18.5 Overloading the Binary Stream Insertion and Stream Extraction Operators
18.6 Overloading Unary Operators
18.7 Overloading the Unary Prefix and Postfix ++ and — Operators
18.8 Case Study: A Date Class
18.9 Dynamic Memory Management
18.10 Case Study: Array Class
18.10.1 Using the Array Class
Creating Arrays, Outputting Their Size and Displaying Their Contents
Using the Overloaded Stream Insertion Operator to Fill an Array
Using the Overloaded Inequality Operator
Initializing a New Array with a Copy of an Existing Array’s Contents
Using the Overloaded Assignment Operator
Using the Overloaded Equality Operator
Using the Overloaded Subscript Operator
18.10.2 Array Class Definition
Overloading the Stream Insertion and Stream Extraction Operators as friends
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
18.11 Operators as Member vs. Non-Member Functions
18.12 Converting Between Types
18.13 explicit Constructors and Conversion Operators
18.14 Overloading the Function Call Operator ()
18.15 Wrap-Up
Summary
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
19 Object-Oriented Programming: Inheritance
Objectives
Outline
19.1 Introduction
19.2 Base Classes and Derived Classes
19.3 Relationship between Base and Derived Classes
19.3.1 Creating and Using a CommissionEmployee Class
CommissionEmployee Constructor
CommissionEmployee Member Functions earnings and print
Testing Class CommissionEmployee
19.3.2 Creating a BasePlusCommissionEmployee Class Without Using Inheritance
Defining Class BasePlusCommissionEmployee
Testing Class BasePlusCommissionEmployee
Exploring the Similarities Between Class BasePlusCommissionEmployee and Class CommissionEmployee
19.3.3 Creating a CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy
Compilation Errors from Accessing Base-Class private Members
Preventing the Errors in BasePlusCommissionEmployee
Including the Base-Class Header in the Derived-Class Header with #include
Linking Process in an Inheritance Hierarchy
19.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
19.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 print
Testing the Modified Class Hierarchy
Summary of the CommissionEmployee–BasePlusCommissionEmployee Examples
19.4 Constructors and Destructors in Derived Classes
19.5 public, protected and private Inheritance
19.6 Software Engineering with Inheritance
19.7 Wrap-Up
Summary
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
20 Object-Oriented Programming: Polymorphism
Objectives
Outline
20.1 Introduction
20.2 Introduction to Polymorphism: Polymorphic Video Game
20.3 Relationships Among Objects in an Inheritance Hierarchy
20.3.1 Invoking Base-Class Functions from Derived-Class Objects
Creating Objects and Displaying Their Contents
Aiming a Base-Class Pointer at a Base-Class Object
Aiming a Derived-Class Pointer at a Derived-Class Object
Aiming a Base-Class Pointer at a Derived-Class Object
20.3.2 Aiming Derived-Class Pointers at Base-Class Objects
20.3.3 Derived-Class Member-Function Calls via Base-Class Pointers
Downcasting
20.3.4 Virtual Functions and Virtual Destructors
Why virtual Functions Are Useful
Declaring virtual Functions
Invoking a virtual Function Through a Base-Class Pointer or Reference
Invoking a virtual Function Through an Object’s Name
virtual Functions in the CommissionEmployee Hierarchy
virtual Destructors
C++11: final Member Functions and Classes
20.4 Type Fields and switch Statements
20.5 Abstract Classes and Pure virtual Functions
20.6 Case Study: Payroll System Using Polymorphism
20.6.1 Creating Abstract Base Class Employee
Employee Class Header
Employee Class Member-Function Definitions
20.6.2 Creating Concrete Derived Class SalariedEmployee
SalariedEmployee Class Member-Function Definitions
20.6.3 Creating Concrete Derived Class CommissionEmployee
20.6.4 Creating Indirect Concrete Derived Class BasePlusCommissionEmployee
20.6.5 Demonstrating Polymorphic Processing
20.7 (Optional) Polymorphism, Virtual Functions and Dynamic Binding “Under the Hood”
20.8 Case Study: Payroll System Using Polymorphism and Runtime Type Information with Downcasting, dynamic_cast, typeid and type_info
20.9 Wrap-Up
Summary
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
Making a Difference
21 Stream Input/Output: A Deeper Look
Objectives
Outline
21.1 Introduction
21.2 Streams
21.2.1 Classic Streams vs. Standard Streams
21.2.2 iostream Library Headers
21.2.3 Stream Input/Output Classes and Objects
Stream-I/O Template Hierarchy and Operator Overloading
Standard Stream Objects cin, cout, cerr and clog
File-Processing Templates
21.3 Stream Output
21.3.1 Output of char * Variables
21.3.2 Character Output Using Member Function put
21.4 Stream Input
21.4.1 get and getline Member Functions
21.4.2 istream Member Functions peek, putback and ignore
21.4.3 Type-Safe I/O
21.5 Unformatted I/O Using read, write and gcount
21.6 Introduction to Stream Manipulators
21.6.1 Integral Stream Base: dec, oct, hex and setbase
21.6.2 Floating-Point Precision (precision, setprecision)
21.6.3 Field Width (width, setw)
21.6.4 User-Defined Output Stream Manipulators
21.7 Stream Format States and Stream Manipulators
21.7.1 Trailing Zeros and Decimal Points (showpoint)
21.7.2 Justification (left, right and internal)
21.7.3 Padding (fill, setfill)
21.7.4 Integral Stream Base (dec, oct, hex, showbase)
21.7.5 Floating-Point Numbers; Scientific and Fixed Notation (scientific, fixed)
21.7.6 Uppercase/Lowercase Control (uppercase)
21.7.7 Specifying Boolean Format (boolalpha)
21.7.8 Setting and Resetting the Format State via Member Function flags
21.8 Stream Error States
21.9 Tying an Output Stream to an Input Stream
21.10 Wrap-Up
Summary
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
22 Exception Handling: A Deeper Look
Objectives
Outline
22.1 Introduction
22.2 Example: Handling an Attempt to Divide by Zero
22.3 Rethrowing an Exception
22.4 Stack Unwinding
22.5 When to Use Exception Handling
22.6 Constructors, Destructors and Exception Handling
22.7 Exceptions and Inheritance
22.8 Processing new Failures
22.9 Class unique_ptr and Dynamic Memory Allocation
22.10 Standard Library Exception Hierarchy
22.11 Wrap-Up
Summary
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
23 Introduction to Custom Templates
Objectives
Outline
23.1 Introduction
23.2 Class Templates
23.3 Function Template to Manipulate a Class-Template Specialization Object
23.4 Nontype Parameters
23.5 Default Arguments for Template Type Parameters
23.6 Overloading Function Templates
23.7 Wrap-Up
Summary
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
A C and C++ Operator Precedence Charts
B ASCII Character Set
C Number Systems
Objectives
Outline
C.1 Introduction
C.2 Abbreviating Binary Numbers as Octal and Hexadecimal Numbers
C.3 Converting Octal and Hexadecimal Numbers to Binary Numbers
C.4 Converting from Binary, Octal or Hexadecimal to Decimal
C.5 Converting from Decimal to Binary, Octal or Hexadecimal
C.6 Negative Binary Numbers: Two’s Complement Notation
Summary
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
D Sorting: A Deeper Look
Objectives
Outline
D.1 Introduction
D.2 Big O Notation
D.3 Selection Sort
D.4 Insertion Sort
D.5 Merge Sort
Summary
Self-Review Exercises
Answers to Self-Review Exercises
Exercises
E Multithreading and Other C11 and C99 Topics
Objectives
Outline
E.1 Introduction
E.2 New C99 Headers
E.3 Designated Initializers and Compound Literals
E.4 Type bool
E.5 Implicit int in Function Declarations
E.6 Complex Numbers
E.7 Additions to the Preprocessor
E.8 Other C99 Features
E.8.1 Compiler Minimum Resource Limits
E.8.2 The restrict Keyword
E.8.3 Reliable Integer Division
E.8.4 Flexible Array Members
E.8.5 Relaxed Constraints on Aggregate Initialization
E.8.6 Type Generic Math
E.8.7 Inline Functions
E.8.8 Return Without Expression
E.8.9 __func__ Predefined Identifier
E.8.10 va_copy Macro
E.9 New Features in the C11 Standard
E.9.1 New C11 Headers
E.9.2 Multithreading Support
Standard Multithreading Implementation
Running Multithreaded Programs
Overview of This Section’s Examples
Example: Sequential Execution of Two Compute-Intensive Tasks
Example: Multithreaded Execution of Two Compute-Intensive Tasks
struct ThreadData
thrd_t
Creating and Executing a Thread
Joining the Threads
Function startFibonacci
Other C11 Multithreading Features
E.9.3 quick_exit function
E.9.4 Unicode® Support
E.9.5 _Noreturn Function Specifier
E.9.6 Type-Generic Expressions
E.9.7 Annex L: Analyzability and Undefined Behavior
E.9.8 Memory Alignment Control
E.9.9 Static Assertions
E.9.10 Floating-Point Types
E.10 Web Resources
Appendices on the Web
People also search for C How to Program 8th:
how to program ti 83 plus
how to program ti 84 ce
how to program c eighth edition
ec codes