Amazon cover image
Image from Amazon.com

Absolute C++ / Walter Savitch.

By: Publication details: Boston : Addison Wesley, c2002.Description: xx, 891 p. : ill. (some col.) ; 24 cm. + 1 computer optical disc (4 3/4 in.)ISBN:
  • 0201709279 (pbk.)
Subject(s): DDC classification:
  • 005.133 21 SAV
Online resources:
Tags from this library: No tags from this library for this title. Log in to add tags.
Star ratings
    Average rating: 0.0 (0 votes)
Holdings
Item type Current library Call number Copy number Status Date due Barcode
Book Open Access Book Open Access Engineering Library 005.133 SAV 1 (Browse shelf(Opens below)) 1 Available 0024970

Contents
Chapter 1. C++ Basics
1.1 Introduction to C++
Origins of the C++ Language
C++ and Object-Oriented Programming
The Character of C++
C++ Terminology
A Sample C++ Program

1.2 Variables, Expressions, and Assignment Statements
Identifiers
Variables
Assignment Statements
Uninitialized Variables
Use Meaningful Names
More Assignment Statements
Assignment Compatibility
Literals
Escape Sequences
Naming Constants
Arithmetic Operators and Expressions
Integer and Floating-Point Division
Division with Whole Numbers
Type Casting
Increment and Decrement Operators
Order of Evaluation

1.3 Console Input/Output
Output Using cout
New Lines in Output
End Each Program with \n or endl
Formatting for Numbers with a Decimal Point
Output with cerr
Input Using cin
Line Breaks in I/O

1.4 Program Style
Comments
Libraries and Namespaces
Libraries and include Directives
Namespaces
Problems with Library Names

Chapter 2. Flow of Control
2.1 Boolean Expressions
Building Boolean Expressions
Strings of Inequalities
Evaluating Boolean Expressions
Precedence Rules 48
Integer Values Can Be Used as Boolean Values

2.2 Branching Mechanisms
if-else Statements
Compound Statements
Using = in Place of = =
Omitting the else
Nested Statements
Multiway if-else Statement
The switch Statement
Forgetting a break in a switch Statement
Use switch Statements for Menus
Enumeration Types
The Conditional Operator

2.3 Loops
The while and do-while Statements
Increment and Decrement Operators Revisited
The Comma Operator
The for Statement
Repeat-N-Times Loops
Extra Semicolon in a for Statement
Infinite Loops
The break and continue Statements
Nested Loops



Chapter 3. Function Basics
3.1 Predefined Functions
Predefined Functions That Return a Value
Predefined void Functions
A Random Number Generator

3.2 Programmer-Defined Functions
Defining Functions That Return a Value
Alternate Form for Function Declarations
Arguments in the Wrong Order
Use of the Terms Parameter and Argument
Functions Calling Functions
A Rounding Function
Functions That Return a Boolean Value
Defining void Functions
return Statements in void Functions
Preconditions and Postconditions
main Is a Function
Recursive Functions

3.3Scope Rules
Local Variables
Procedural Abstraction
Global Constants and Global Variables
Blocks
Nested Scopes
Use Function Calls in Branching and Loop Statements
Variables Declared in a for Loop



Chapter 4. Parameters and Overloading
4.1 Parameters
Call-by-Value Parameters
A First Look at Call-by-Reference Parameters
Call-by-Reference Mechanism in Detail
The swapValues Function
Constant Reference Parameters
Think of Actions, Not Code
Mixed Parameter Lists
What Kind of Parameter to Use
Inadvertent Local Variables
Choosing Formal Parameter Names
Buying Pizza

4.2 Overloading and Default Arguments
Introduction to Overloading
Automatic Type Conversion and Overloading
Rules for Resolving Overloading
Revised Pizza-Buying Program
Default Arguments

4.3 Testing and Debugging Functions
The assert Macro
Stubs and Drivers



Chapter 5. Arrays
5.1 Introduction to Arrays
Declaring and Referencing Arrays
Use for Loops with Arrays
Array Indexes Always Start with Zero
Use a Defined Constant for the Size of an Array
Arrays in Memory
Array Index Out of Range
Initializing Arrays

5.2 Arrays in Functions
Indexed Variables as Function Arguments
Entire Arrays as Function Arguments
The const Parameter Modifier
Inconsistent Use of const Parameters
Functions That Return an Array
Production Graph

5.3 Programming with Arrays
Partially Filled Arrays
Do Not Skimp on Formal Parameters
Searching an Array
Sorting an Array

5.4 Multidimensional Arrays
Multidimensional Array Basics
Multidimensional Array Parameters
Two-Dimensional Grading Program



Chapter 6. Structures and Classes
6.1 Structures
Structure Types
Forgetting a Semicolon in a Structure Definition
Structures as Function Arguments
Use Hierarchical Structures
Initializing Structures

6.2 Classes
Defining Classes and Member Functions
Encapsulation
Public and Private Members
Accessor and Mutator Functions
Separate Interface and Implementation
A Test for Encapsulation
Structures versus Classes
Thinking Objects



Chapter 7. Constructors and Other Tools
7.1 Constructors
Constructor Definitions
Constructors with No Arguments
Explicit Constructor Calls
Always Include a Default Constructor
BankAccount Class
Class Type Member Variables

7.2 More Tools
The const Parameter Modifier
Inconsistent Use of const
Inline Functions
Static Members
Nested and Local Class Definitions

7.3 Vectors; A Preview of the Standard Template Library
Vector Basics
Using Square Brackets beyond the Vector Size
Vector Assignment Is Well Behaved
Efficiency Issues



Chapter 8. Operator Overloading, Friends, and References
8.1 Basic Operator Overloading
Overloading Basics
A Constructor Can Return an Object
Returning by const Value
Returning Member Variables of a Class Type
Overloading Unary Operators
Overloading as Member Functions
A Class Has Access to All Its Objects
Overloading Function Application ( )
Overloading &&, ||, and the Comma Operator

8.2 Friend Functions and Automatic Type Conversion
Constructors for Automatic Type Conversion
Member Operators and Automatic Type Conversion
Friend Functions
Compilers without Friends
Friend Classes

8.3 References and More Overloaded Operators
References
Returning a Reference to Certain Member Variables
Overloading >> and <<
What Mode of Returned Value to Use
The Assignment Operator
Overloading the Increment and Decrement Operators
Overloading the Array Operator [ ]
Overloading Based on L-Value versus R-Value



Chapter 9. Strings
9.1 An Array Type for Strings
C-String Values and C-String Variables
Using = and == with C-strings
Other Functions in
C-String Input and Output

9.2 Character Manipulation Tools
Character I/O
The Member Functions get and put
Checking Input Using a Newline Function
Unexpected '\n' in Input
The putback, peek, and ignore Member Functions
Character-Manipulating Functions
toupper and tolower Return int Values

9.3 The Standard Class string
Introduction to the Standard Class string
I/O with the Class string
More Versions of getline
Mixing cin >> variable; and getline
String Processing with the Class string
Palindrome Testing
Converting between string Objects and C-Strings



Chapter 10. Pointers and Dynamic Arrays
10.1 Pointers
Pointer Variables
Basic Memory Management
Dangling Pointers
Dynamic Variables and Automatic Variables
Define Pointer Types
Pointers as Call-by-Value Parameters
Uses for Pointers

10.2 Dynamic Arrays
Array Variables and Pointer Variables
Creating and Using Dynamic Arrays
A Function That Returns an Array
Pointer Arithmetic
Multidimensional Dynamic Arrays

10.3 Classes, Pointers, and Dynamic Arrays
The -> Operator
The this Pointer
Overloading the Assignment Operator
A Class for Partially Filled Arrays
Destructors
Copy Constructors



Chapter 11. Separate Compilation and Namespaces
11.1 Separate Compilation
Encapsulation Reviewed
Header Files and Implementation Files
DigitalTime Class
Reusable Components
Using #ifndef
Defining Other Libraries

11.2 Namespaces
Namespaces and using Directives
Creating a Namespace
Using Declarations
Qualifying Names
A Class Definition in a Namespace
Choosing a Name for a Namespace
Unnamed Namespaces
Confusing the Global Namespace and the Unnamed Namespace
Unnamed Namespaces Replace the static Qualifier
Hiding Helping Functions
Nested Namespaces
What Namespace Specification Should You Use?



Chapter 12. Streams and File I/O
12.1 I/O Streams
File I/O
Restrictions on Stream Variables
Appending to a File
Another Syntax for Opening a File
Check That a File Was Opened Successfully
Character I/O
Checking for the End of a File

12.2 Tools for Stream I/O
File Names as Input
Formatting Output with Stream Functions
Manipulators
Saving Flag Settings
More Output Stream Member Functions
Cleaning Up a File Format
Editing a Text File

12.3Stream Hierarchies: A Preview of Inheritance
Inheritance among Stream Classes
Another newLine Function

12.4 Random Access to Files


Chapter 13. Recursion
13.1 Recursive void Functions
Vertical Numbers
Tracing a Recursive Call
A Closer Look at Recursion
Infinite Recursion
Stacks for Recursion
Stack Overflow
Recursion versus Iteration

13.2 Recursive Functions That Return a Value
General Form for a Recursive Function That Returns a Value
Another Powers Function

13.3 Thinking Recursively
Recursive Design Techniques
Binary Search



Chapter 14. Inheritance
14.1 Inheritance Basics
Derived Classes
Constructors in Derived Classes
Use of Private Member Variables from the Base Class
Private Member Functions Are Effectively Not Inherited
The protected Qualifier
Redefinition of Member Functions
Redefining versus Overloading
Access to a Redefined Base Function
Functions That Are Not Inherited

14.2 Programming with Inheritance
Assignment Operators and Copy Constructors in Derived Classes
Destructors in Derived Classes
Partially Filled Array with Backup
Same Object on Both Sides of the Assignment Operator
Alternate Implementation of PFArrayDBak
A Class Has Access to Private Members of All Objects of the Class
"Is a" versus "Has a"
Protected and Private Inheritance
Multiple Inheritance



Chapter 15. Polymorphism and Virtual Functions
15.1 Virtual Function Basics
Late Binding
Virtual Functions in C++
The Virtual Property Is Inherited
When to Use a Virtual Function
Omitting the Definition of a Virtual Member Function
Abstract Classes and Pure Virtual Functions
An Abstract Class

15.2 Pointers and Virtual Functions
Virtual Functions and Extended Type Compatibility
The Slicing Problem
Make Destructors Virtual
Downcasting and Upcasting
How C++ Implements Virtual Functions



Chapter 16. Templates
16.1 Function Templates
Syntax for Function Templates
Compiler Complications
A Generic Sorting Function
How to Define Templates
Using a Template with an Inappropriate Type

16.2 Class Templates
Syntax for Class Templates
An Array Template Class
The vector and basic_string Templates

16.3 Templates and Inheritance
Template Class for a Partially Filled Array with Backup



Chapter 17. Linked Data Structures
17.1 Nodes and Linked Lists
Nodes
Linked Lists
Inserting a Node at the Head of a List
Losing Nodes
Inserting and Removing Nodes Inside a List
Using the Assignment Operator with Dynamic Data Structures
Searching a Linked List
Template Version of Linked List Tools

17.2 Linked List Applications
A Stack Template Class
A Queue Template Class
A Comment on Namespaces
Friend Classes and Similar Alternatives

17.3 Iterators
Pointers as Iterators
Iterator Classes
An Iterator Class

17.4 Trees
Tree Properties
A Tree Template Class



Chapter 18. Exception Handling
18.1 Exception Handling Basics
A Toy Example of Exception Handling
Defining Your Own Exception Classes
Multiple Throws and Catches
Catch the More Specific Exception First
Exception Classes Can Be Trivial
Throwing an Exception in a Function
Exception Specification
Exception Specification in Derived Classes

18.2 Programming Techniques for Exception Handling
When to Throw an Exception
Uncaught Exceptions
Nested try-catch Blocks
Overuse of Exceptions
Exception Class Hierarchies
Testing for Available Memory
Rethrowing an Exception



Chapter 19. Standard Template Library
19.1 Iterators
Iterator Basics
Kinds of Iterators
Constant and Mutable Iterators
Reverse Iterators
Compiler Problems
Other Kinds of Iterators

19.2 Containers
Sequential Containers
Iterators and Removing Elements
Type Definitions in Containers
The Container Adapters stack and queue
The Associative Containers set and map
Efficiency

19.3 Generic Algorithms
Running Times and Big-O Notation
Container Access Running Times
Nonmodifying Sequence Algorithms
Modifying Sequence Algorithms
Set Algorithms
Sorting Algorithms



Chapter 20. Patterns and UML
20.1 Patterns
Adapter Pattern
The Model-View-Controller Pattern
A Sorting Pattern
Efficiency of the Sorting Pattern
Pragmatics and Patterns
Pattern Formalism

20.2 UML
History of UML
UML Class Diagrams
Class Interactions



C++ Keywords 855
Precedence of Operators
The ASCII Character Set
Some Library Functions
Arithmetic Functions
Input and Output Member Functions
Character Functions
C-String Functions
string Class Functions
Random Number Generator
Trigonometric Functions
Old and New Header Files

Includes Bibliographic references ( p. 871- 872) and index(p.873-891)

There are no comments on this title.

to post a comment.