did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

We're the #1 textbook rental company. Let us show you why.

9780321330239

Absolute C++

by
  • ISBN13:

    9780321330239

  • ISBN10:

    0321330234

  • Edition: 2nd
  • Format: Paperback
  • Copyright: 2006-01-01
  • Publisher: Addison Wesley
  • View Upgraded Edition
  • Purchase Benefits
  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $110.80

Summary

Offers complete coverage of the C++ programming language.This title offers provides all the tools necessary for experienced and novice programmers to master C++, including: thorough coverage of the Standard Template Library; complete and fully executable code throughout; sections highlighting programming tips and common pitfalls; and a logical order of coverage of C++ topics in order for readers to better understand the language.This book is appropriate for anyone interested in learning how to programming using the C++ programming language.

Table of Contents

C++ Basics
1(44)
Introduction to C++
2(4)
Origins of the C++ Language
2(1)
C++ and Object-Oriented Programming
3(1)
The Character of C++
3(1)
C++ Terminology
4(1)
A Sample C++ Program
4(2)
Variables, Expressions, and Assignment Statements
6(22)
Identifiers
6(2)
Variables
8(2)
Assignment Statements
10(2)
Pitfall: Uninitialized Variables
12(1)
Tip: Use Meaningful Names
13(1)
More Assignment Statements
13(1)
Assignment Compatibility
14(1)
Literals
15(2)
Escape Sequences
17(1)
Naming Constants
17(2)
Arithmetic Operators and Expressions
19(2)
Integer and Floating-Point Division
21(1)
Pitfall: Division and Whole Number
22(1)
Type Casting
23(2)
Increment and Decrement Operators
25(2)
Pitfall: Order of Evaluation
27(1)
Console Input/Output
28(7)
Output Using cout
28(1)
New Lines in Output
29(1)
Tip: End Each Program with \n or endl
30(1)
Formatting for Numbers with a Decimal Point
31(1)
Output with cerr
32(1)
Input Using cin
32(2)
Tip: Line Breaks in I/O
34(1)
Program Style
35(1)
Comments
35(1)
Libraries and Namespaces
36(9)
Libraries and include Directives
36(1)
Namespaces
37(1)
Pitfall: Problems with Library Names
38(1)
Chapter Summary
38(1)
Answers to Self-Test Exercises
39(2)
Programming Projects
41(4)
Flow of Control
45(50)
Boolean Expression
46(11)
Building Boolean Expressions
46(1)
Pitfall: Strings of Inequalities
47(1)
Evaluating Boolean Expressions
48(2)
Precedence Rule
50(4)
Pitfall: Integer Values Can Be Used as Boolean Values
54(3)
Branching Mechanisms
57(12)
if-else Statements
57(1)
Compound Statements
57(2)
Pitfall: Using = in Place of = =
59(2)
Omitting the else
61(1)
Nested Statement
62(1)
Multiway if-else Statement
62(1)
The switch Statement
62(4)
Pitfall: Forgetting a break in a switch Statement
66(1)
Tip: Use switch Statements for Menu
66(1)
Enumeration Types
66(1)
The Conditional Operation
67(2)
Loops
69(26)
The while and do-while Statements
69(3)
Increment and Decrement Operators Revisited
72(3)
The Comma Operator
75(1)
The for Statement
76(3)
Tip: Repeat-N-Times Loops
79(1)
Pitfall: Extra Semicolon in a for Statement
79(1)
Pitfall: Infinite Loops
80(3)
The break and continue Statement
83(3)
Nested Loops
86(1)
Chapter Summary
86(1)
Answers to Self-Test Exercises
87(5)
Programming Projects
92(3)
Function Basics
95(44)
Predefined Functions
96(12)
Predefined Functions That Return a Value
96(5)
Predefined void Functions
101(2)
A Random Number Generator
103(5)
Programmer-Defined Functions
108(13)
Defining Functions That Return a Value
108(3)
Alternate Form for Function Declarations
111(1)
Pitfall: Arguments in the Wrong Order
111(1)
Pitfall: Use the Terms Parameter and Argument
111(1)
Functions Calling Functions
112(1)
Example: A Rounding Function
112(2)
Functions That Return a Boolean Value
114(1)
Defining void Functions
115(2)
return Statements in void Functions
117(2)
Preconditions and Postconditions
119(1)
main is a Function
119(1)
Recursive Functions
120(1)
Scope Rules
121(18)
Local Variables
122(1)
Procedural Abstraction
122(3)
Global Constants and Global Variables
125(3)
Blocks
128(1)
Nested Scopes
129(1)
Tip: Use Function Calls in Branching and Loop Statements
129(1)
Variables Declared in a for Loop
130(1)
Chapter Summary
131(1)
Answers to Self-Test Exercises
131(4)
Programming Projects
135(4)
Parameters and Overloading
139(42)
Parameters
140(18)
Call-by-Value Parameters
140(3)
A First Look at Call-by-Reference Parameters
143(2)
Call-by-Reference Mechanism in Detail
145(2)
Constant Reference Parameters
147(1)
Example: The swap Values Function
148(1)
Tip: Think of Actions, Not Code
149(1)
Mixed Parameter Lists
150(1)
Tip: What Kind of Parameter to Use
151(1)
Pitfall: Inadvertent Local Variables
152(3)
Tip: Choosing Formal Parameter Names
155(1)
Example: Buying Pizza
155(3)
Overloading and Default Arguments
158(11)
Introduction to Overloading
159(2)
Pitfall: Automatic Type Conversion and Overloading
161(2)
Rules for Resolving Overloading
163(1)
Example: Revised Pizza-Buying Program
164(3)
Default Arguments
167(2)
Testing and Debugging Functions
169(12)
The assert Macro
169(1)
Stubs and Drivers
170(4)
Chapter Summary
174(1)
Answers to Self-Test Exercises
174(2)
Programming Projects
176(5)
Arrays
181(54)
Introduction to Arrays
182(9)
Declaring and Referencing Arrays
182(3)
Tip: Use for Loops with Arrays
185(1)
Pitfall: Array Indexes Always Start with Zero
185(1)
Tip: Use a Defined Constant for the Size of an Array
185(1)
Arrays in Memory
186(1)
Pitfall: Array Index Out of Range
187(2)
Initializing Arrays
189(2)
Arrays in Functions
191(13)
Indexed Variables as Function Arguments
191(2)
Entire Arrays as Function Arguments
193(3)
The const Parameter Modifier
196(2)
Pitfall: Inconsistent Use of const Parameters
198(1)
Functions That Return an Array
198(1)
Example: Production Graph
199(5)
Programming With Arrays
204(10)
Partially Filled Arrays
204(1)
Tip: Do Not Skimp on Formal Parameters
205(2)
Example: Searching an Array
207(3)
Example: Sorting an Array
210(4)
Multidimensional Arrays
214(21)
Multidimensional Array Basics
214(2)
Multidimensional Array Parameters
216(1)
Example: Two-Dimensional Grading Program
217(5)
Chapter Summary
222(1)
Answers to Self-Test Exercises
223(4)
Programming Projects
227(8)
Structures and Classes
235(36)
Structures
236(13)
Structure Types
238(4)
Pitfall: Forgetting a Semicolon in a Structure Definition
242(1)
Structures as Function Arguments
242(1)
Tip: Use Hierarchical Structures
243(3)
Initializing Structures
246(3)
Classes
249(22)
Defining Classes and Member Functions
249(5)
Encapsulation
254(1)
Public and Private Members
255(4)
Accessor and Mutator Functions
259(2)
Tip: Separate Interface and Implementation
261(1)
Tip: A Test for Encapsulation
262(1)
Structures versus Classes
263(2)
Tip: Thinking Objects
265(1)
Chapter Summary
265(1)
Answers to Self-Test Exercises
266(2)
Programming Projects
268(3)
Constructors and Other Tools
271(46)
Constructors
272(19)
Constructor Definitions
272(5)
Pitfall: Constructors with No Arguments
277(2)
Explicit Constructor Calls
279(1)
Tip: Always Include a Default Constructor
279(3)
Example: BankAccount Class
282(6)
Class Type Member Variables
288(3)
More Tools
291(13)
The const Parameter Modifier
292(2)
Pitfall: Inconsistent Use of const
294(4)
Inline Functions
298(1)
Static Members
299(5)
Nested and Local Class Definitions
304(1)
Vectors---A Previews of the Standard Template Library
304(13)
Vector Basics
305(3)
Pitfall: Using Square Brackets beyond the Vector Size
308(1)
Tip: Vector Assignment Is Well Behaved
309(1)
Efficiency Issues
309(2)
Chapter Summary
311(1)
Answers to Self-Test Exercises
311(3)
Programming Projects
314(3)
Operator Overloading, Friends, and References
317(50)
Basic Operator Overloading
318(16)
Overloading Basics
319(5)
Tip: A Constructor Can Return an Object
324(1)
Returning by const Value
325(3)
Tip: Returning Member Variables of a Class Type
328(1)
Overloading Unary Operators
329(1)
Overloading as Members Functions
330(2)
Tip: A Class Has Access to All Its Objects
332(1)
Overloading Function Application ( )
333(1)
Pitfall: Overloading &&, ||, and the Comma Operator
334(1)
Friend Functions and Automatic Type Conversion
334(8)
Constructors for Automatic Type Conversion
334(1)
Pitfall: Member Operators and Automatic Type Conversion
335(1)
Friend Functions
336(4)
Pitfall: Compilers without Friends
340(1)
Friend Classes
340(2)
References and More Overloaded Operators
342(25)
References
342(1)
Pitfall: Returning a Reference to Certain Member Variables
343(1)
Overloading >> and <<
344(7)
Tip: What Mode of Returned Value to Use
351(2)
The Assignment Operator
353(1)
Overloading the Increment and Decrement Operators
354(3)
Overloading the Array Operator [ ]
357(2)
Overloading Based on L-Value versus R-Value
359(1)
Chapter Summary
359(1)
Answers to Self-Test Exercises
360(2)
Programming Projects
362(5)
Strings
367(54)
An Array Type for Strings
368(14)
C-String Values and C-String Variables
369(4)
Pitfall: Using = and = = with C-Strings
373(2)
Other Functions in <cstring>
375(4)
C-String Input and Output
379(3)
Character Manipulation Tools
382(12)
Character I/O
382(1)
The Member Functions get and put
382(3)
Example: Checking Input Using a Newline Function
385(1)
Pitfall: Unexpected `\n' in Input
386(2)
The putback, peek, and ignore Member Functions
388(2)
Character-Manipulating Functions
390(2)
Pitfall: toupper and to lower Return int Values
392(2)
The Standard Class string
394(27)
Introduction to the Standard Class string
394(2)
I/O with the Class string
396(5)
Tip: More Versions of getline
401(1)
Pitfall: Mixing cin >> variable; and getline
401(1)
String Processing with the Class string
402(4)
Example: Palindrome Testing
406(5)
Converting between string Objects and C-Strings
411(1)
Chapter Summary
411(1)
Answers to Self-Test Exercises
412(3)
Programming Projects
415(6)
Pointers and Dynamic Arrays
421(54)
Pointers
422(17)
Pointer Variables
423(8)
Basic Memory Management
431(3)
Pitfall: Dangling Pointers
434(1)
Dynamic Variables and Automatic Variables
434(1)
Tip: Define Pointer Types
435(2)
Pitfall: Pointers as Call-by-Value Parameters
437(2)
Uses for Pointers
439(1)
Dynamic Arrays
439(12)
Array Variables and Pointer Variables
439(2)
Creating and Using Dynamic Arrays
441(4)
Example: A Function That Returns an Array
445(2)
Pointer Arithmetic
447(1)
Multidimensional Dynamic Arrays
448(3)
Classes, Pointers, and Dynamic Arrays
451(24)
The -< Operator
451(1)
The this Pointer
452(1)
Overloading the Assignment Operator
453(3)
Example: A Class for Partially Filled Arrays
456(7)
Destructors
463(2)
Copy Constructors
465(4)
Chapter Summary
469(1)
Answers to Self-Test Exercises
470(2)
Programming Projects
472(3)
Separate Compilation and Namespaces
475(44)
Separate Compilation
476(15)
Encapsulation Reviewed
477(1)
Header Files and Implementation Files
478(8)
Example: DigitalTime Class
486(1)
Tip: Reusable Components
487(1)
Using #ifndef
487(3)
Tip: Defining Other Libraries
490(1)
Namespaces
491(28)
Namespaces and using Directives
491(2)
Creating a Namespace
493(3)
Using Declarations
496(2)
Qualifying Names
498(2)
Tip: Choosing a Name for a Namespace
500(1)
Example: A Class Definition in a Namespace
501(1)
Unnamed Namespaces
502(7)
Pitfall: Confusing the Global Namespace and the Unnamed Namespace
509(1)
Tip: Unnamed Namespaces Replace the static Qualifer
509(1)
Tip: Hiding Helping Functions
509(1)
Nested Namespaces
510(1)
Tip: What Namespace Specification Should You Use?
510(4)
Chapter Summary
514(1)
Answers to Self-Test Exercises
514(2)
Programming Projects
516(3)
Streams and File I/O
519(52)
I/O Streams
521(16)
File I/O
521(5)
Pitfall: Restrictions on Stream Variables
526(1)
Appending to a File
526(2)
Tip: Another Syntax for Opening a File
528(1)
Tip: Check That a File Was Opened Successfully
529(3)
Character I/O
532(1)
Checking for the End of a File
533(4)
Tools for Stream I/O
537(14)
File Names as Input
537(1)
Formatting Output with Stream Functions
538(4)
Manipulators
542(1)
Saving Flag Settings
543(1)
More Output Stream Member Functions
544(2)
Example: Cleaning Up a File Format
546(2)
Example: Editing a Text File
548(3)
Stream Hierarchies: A Preview of Inheritance
551(6)
Inheritance among Stream Classes
551(2)
Example: Another new Line Function
553(4)
Random Access to Files
557(14)
Chapter Summary
559(1)
Answers to Self-Test Exercises
559(3)
Programming Projects
562(9)
Recursion
571(38)
Recursive void Functions
573(12)
Example: Vertical Numbers
573(3)
Tracing a Recursive Call
576(3)
A Closer Look at Recursion
579(1)
Pitfall: Infinite Recursion
580(2)
Stacks for Recursion
582(2)
Pitfall: Stack Overflow
584(1)
Recursion versus Iteration
584(1)
Recursive Functions That Return a Value
585(6)
General Form for a Recursive Function That Returns a Value
585(1)
Example: Another Powers Function
586(5)
Thinking Recursively
591(18)
Recursive Design Techniques
591(1)
Binary Search
592(9)
Chapter Summary
601(1)
Answers to Self-Test Exercises
601(5)
Programming Projects
606(3)
Inheritance
609(46)
Inheritance Basics
610(23)
Derived Classes
610(10)
Constructors in Derived Classes
620(2)
Pitfall: Use of Private Member Variables from the Base Class
622(2)
Pitfall: Private Member Functions Are Effectively Not Inherited
624(1)
The protected Qualifier
624(3)
Redefinition of Member Functions
627(2)
Redefining versus Overloading
629(1)
Access to a Redefined Base Function
630(1)
Functions That Are Not Inherited
631(2)
Programming With Inheritance
633(22)
Assignment Operators and Copy Constructors in Derived Classes
633(1)
Destructors in Derived Classes
634(1)
Example: Partially Filled Array with Backup
634(9)
Pitfall: Same Object on Both Sides of the Assignment Operator
643(1)
Example: Alternate Implementation of PFArrayDBak
644(3)
Tip: A Class Has Access to Private Members of All Objects of the Class
647(1)
Tip: ``Is a'' versus ``Has a''
647(1)
Protected and Private Inheritance
648(1)
Multiple Inheritance
649(1)
Chapter Summary
650(1)
Answers to Self-Test Exercises
650(2)
Programming Projects
652(3)
Polymorphism and Virtual Functions
655(28)
Virtual Function Basics
656(13)
Late Binding
656(1)
Virtual Functions in C++
657(7)
Tip: The Virtual Property Is Inherited
664(1)
Tip: When to Use a Virtual Function
664(1)
Pitfall: Omitting the Definition of a Virtual Member Function
665(1)
Abstract Classes and Pure Virtual Functions
665(2)
Example: An Abstract Class
667(2)
Pointers and Virtual Functions
669(14)
Virtual Functions and Extended Type Compatibility
669(5)
Pitfall: The Slicing Problem
674(1)
Tip: Make Destructors Virtual
675(1)
Downcasting and Upcasting
676(2)
How C++ Implements Virtual Functions
678(1)
Chapter Summary
679(1)
Answers to Self-Test Exercises
679(1)
Programming Projects
680(3)
Templates
683(38)
Function Templates
684(14)
Syntax for Function Templates
686(3)
Pitfall: Compiler Complications
689(1)
Tip: How to Define Templates
690(2)
Example: A Generic Sorting Function
692(4)
Pitfall: Using a Template with an Inappropriate Type
696(2)
Class Templates
698(11)
Syntax for Class Templates
698(5)
Example: An Array Template Class
703(6)
The vector and basic_string Templates
709(1)
Templates and Inheritance
709(12)
Example: Template Class for a Partially Filled Array with Backup
710(6)
Chapter Summary
716(1)
Answers to Self-Test Exercises
716(4)
Programming Projects
720(1)
Linked Data Structures
721(72)
Nodes and Linked Lists
723(24)
Nodes
723(5)
Linked Lists
728(2)
Inserting a Node at the Head of a List
730(3)
Pitfall: Losing Nodes
733(1)
Inserting and Removing Nodes Inside a List
734(4)
Pitfall: Using the Assignment Operator with Dynamic Data Structures
738(1)
Searching a Linked List
738(5)
Example: A Generic Sorting Template Version of Linked List Tools
743(4)
Linked List Applications
747(15)
Example: A Stack Template Class
748(7)
Example: A Queue Template Class
755(3)
Tip: A Comment on Namespaces
758(1)
Friend Classes and Similar Alternatives
759(3)
Iterators
762(9)
Pointers as Iterators
762(1)
Iterator Classes
763(1)
Example: An Iterator Class
764(7)
Trees
771(22)
Tree Properties
772(3)
Example: A Tree Template Class
775(5)
Chapter Summary
780(1)
Answers to Self-Test Exercises
780(8)
Programming Projects
788(5)
Exception Handling
793(30)
Exception Handling Basics
795(20)
A Toy Example of Exception Handling
795(9)
Defining Your Own Exception Classes
804(2)
Multiple Throws and Catches
806(2)
Pitfall: Catch the More Specific Exception First
808(1)
Tip: Exception Classes Can Be Trivial
809(1)
Throwing an Exception in a Function
810(1)
Exception Specification
810(4)
Pitfall: Exception Specification in Derived Classes
814(1)
Programming Techniques for Exception Handling
815(8)
When to Throw an Exception
815(2)
Pitfall: Uncaught Exceptions
817(1)
Pitfall: Nested try-catch Blocks
817(1)
Pitfall: Overuse of Exceptions
818(1)
Exception Class Hierarchies
818(1)
Testing for Available Memory
818(1)
Rethrowing an Exception
819(1)
Chapter Summary
819(1)
Answers to Self-Test Exercises
820(1)
Programming Projects
821(2)
Standard Template Library
823(52)
Iterators
825(14)
Iterator Basics
825(6)
Kinds of Iterators
831(3)
Constant and Mutable Iterators
834(2)
Reverse Iterators
836(2)
Pitfall: Compiler Problems
838(1)
Other Kinds of Iterators
838(1)
Containers
839(14)
Sequential Containers
839(5)
Pitfall: Iterators and Removing Elements
844(1)
Tip: Type Definitions in Containers
844(1)
The Container Adapters stack and queue
845(1)
The Associative Containers set and map
846(5)
Efficiency
851(2)
Generic Algorithms
853(22)
Running Times and Big-O Notation
854(4)
Container Access Running Times
858(1)
Nonmodifying Sequence Algorithms
859(4)
Modifying Sequence Algorithms
863(2)
Set Algorithms
865(1)
Sorting Algorithms
865(2)
Chapter Summary
867(1)
Answers to Self-Test Exercises
868(2)
Programming Projects
870(5)
Patterns and UML
875(36)
Patterns
876(11)
Adapter Pattern
877(1)
The Model-View-Controller Pattern
877(2)
Example: A Sorting Pattern
879(6)
Efficiency of the Sorting Pattern
885(1)
Tip: Pragmatics and Patterns
886(1)
Pattern Formalism
886(1)
UML
887(6)
History of UML
887(1)
UML Class Diagrams
888(1)
Class Interactions
889(1)
Chapter Summary
889(1)
Answers to Self-Test Exercises
889(2)
Programming Projects
891(2)
Appendix 1 C++ Keywords
893(2)
Appendix 2 Precedence of Operators
895(4)
Appendix 3 The ASCII Character Set
899(2)
Appendix 4 Some Library Functions
901(8)
Arithmetic Functions
901(1)
Input and Output Member Functions
902(1)
Character Functions
903(1)
C-String Functions
904(2)
string Class Functions
906(1)
Random Number Generator
907(1)
Trigonometric Functions
908(1)
Appendix 5 Old and New Header Files
909(2)
Further Reading 911(2)
Index 913

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Rewards Program