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.

9780321113474

Problem Solving with C++ : The Object of Programming

by
  • ISBN13:

    9780321113474

  • ISBN10:

    0321113470

  • Edition: 4th
  • Format: Paperback
  • Copyright: 2002-07-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: $76.00 Save up to $0.38
  • Buy New
    $75.62
    Add to Cart Free Shipping Icon Free Shipping

    USUALLY SHIPS IN 2-3 BUSINESS DAYS

Supplemental Materials

What is included with this book?

Summary

This is the world's leading book for teaching introductory programming concepts and C++ to novices. This book teaches readers how to define their own classes early, while ensuring a solid understanding of basic tools such as simple control structures and function definitions. It takes a measured approach to classes, teaching how to write some simple classes, then adds constructors, then overloading simple operators, then overloading the I/O operators << and >>, and so forth. Anyone beginning to program with C++.

Table of Contents

Introduction to Computers and C++ Programming
1(38)
Computer Systems
2(11)
Hardware
2(5)
Software
7(1)
High-level languages
8(1)
Compilers
9(3)
History Note
12(1)
Programming and Problem-Solving
13(6)
Algorithms
14(1)
Program Design
15(2)
Object-Oriented Programming
17(1)
The Software Life Cycle
18(1)
Introduction to C++
19(12)
Origins of the C++ language
19(1)
A Sample C++ Program
20(4)
Pitfall: Using the Wrong Slash in \n
24(1)
Programming Tip: Input and Output Syntax
25(1)
Layout of a Simple C++ Program
25(2)
Pitfall: Putting a Space before the include File Name
27(1)
Compiling and Running a C++ Program
28(1)
Programming Tip: Getting Your Program to Run
28(3)
Testing and Debugging
31(8)
Kinds of Program Errors
32(1)
Pitfall: Assuming Your Program Is Correct
33(1)
Chapter Summary
34(1)
Answers to Self-Test Exercises
35(2)
Programming Projects
37(2)
C++ Basics
39(70)
Variables and Assignments
40(10)
Variables
40(1)
Names: Identifiers
41(3)
Variable Declarations
44(2)
Assignment Statements
46(2)
Pitfall: Uninitialized Variables
48(1)
Programming Tip: Use Meaningful Names
49(1)
Input and Output
50(11)
Output Using cout
51(1)
Include Directives and Namespaces
52(2)
Escape Sequences
54(1)
Programming Tip: End Each Program with a \n or endl
55(1)
Formatting for Numbers with a Decimal Point
55(2)
Input Using cin
57(2)
Designing Input and Output
59(1)
Programming Tip: Line Breaks in I/O
59(2)
Data types and Expressions
61(12)
The Types int and double
61(1)
Other Number Types
62(2)
The Type char
64(1)
The Type bool
65(1)
Type Compatibilities
65(3)
Arithmetic Operators and Expressions
68(3)
Pitfall: Whole Numbers in Division
71(1)
More Assignment Statements
72(1)
Simple Flow of Control
73(20)
A Simple Branching Mechanism
73(6)
Pitfall: Strings of Inequalities
79(1)
Pitfall: Using = in place of ==
80(1)
Compound Statements
81(2)
Simple loop Mechanisms
83(4)
Increment and Decrement Operators
87(2)
Programming Example: Charge Card Balance
89(1)
Pitfall: Infinite Loops
90(3)
Program Style
93(16)
Indenting
93(1)
Comments
94(1)
Naming Constants
95(3)
Chapter Summary
98(1)
Answers to Self-Test Exercises
99(6)
Programming Projects
105(4)
Procedural Abstraction and Functions That Return a Value
109(66)
Top-Down Design
110(1)
Predefined Functions
111(9)
Using Predefined Functions
111(6)
Type Casting
117(1)
Older Form of Type Casting
118(1)
Pitfall: Integer Division Drops the Functional Part
119(1)
Programmer-Defined Functions
120(12)
Function Definitions
121(4)
Alternate Form for Function Declarations
125(3)
Pitfall: Arguments in the Wrong Order
128(1)
Function Definition-Syntax Summary
128(3)
More about Placement of Function Definitions
131(1)
Procedural Abstraction
132(11)
The Block Box Analogy
132(3)
Programming Tip: Choosing Formal Parameter Names
135(1)
Case Study: Buying Pizza
135(7)
Programming Tip: Use Pseudocode
142(1)
Local Variables
143(14)
The Small Program Analogy
144(3)
Programming Example: Experimental Pea Patch
147(1)
Global Constants and Global Variables
147(1)
Call-by-Value Formal Parameters Are Local Variables
148(4)
Namespaces Revisited
152(3)
Programming Example: The Factorial Function
155(2)
Overloading Function Names
157(18)
Introduction to Overloading
157(3)
Programming Example: Revised Pizza-Buying Program
160(1)
Automatic Type Conversion
161(5)
Chapter Summary
166(1)
Answers to Self-Test Exercises
166(4)
Programming Projects
170(5)
Functions for All Subtasks
175(50)
void Functions
176(8)
Definitions of void Functions
177(2)
Programming Example: Converting Temperatures
179(1)
return Statements in void Functions
179(5)
Call-by-Reference Parameters
184(14)
A First View of Call-by-Reference
184(4)
Call-by-Reference in Detail
188(3)
Programming Example: The swap_values Function
191(1)
Mixed Parameter lists
192(2)
Programming Tip: What Kind of Parameter to Use
194(1)
Pitfall: Inadvertent local Variables
194(4)
Using Procedural Abstraction
198(10)
Functions Calling Functions
198(1)
Preconditions and Postconditions
199(3)
Case Study: Supermarket Pricing
202(6)
Testing and Debugging Functions
208(17)
Stubs and Drivers
209(5)
Chapter Summary
214(1)
Answers to Self-Test Exercises
215(4)
Programming Projects
219(6)
I/O Streams as an Introduction to Objects and Classes
225(82)
Streams and Basic File I/O
227(20)
Why Use Files for I/O?
228(1)
File I/O
228(3)
Introduction to Classes and Objects
231(4)
Programming Tip: Check That a File Was Opened Successfully
235(2)
Techniques for File I/O
237(4)
Appending to a File (Optional)
241(1)
File Names as Input (Optional)
241(6)
Tools for Stream I/O
247(15)
Formatting Output with Stream Functions
247(3)
Manipulators
250(4)
Streams as Arguments to Functions
254(3)
Programming Tip: Checking for the End of a File
257(2)
A Note on Namespaces
259(1)
Programming Example: Cleaning Up a File Format
260(2)
Character I/O
262(21)
The Member Functions get and put
262(3)
The putback Member Function (Optional)
265(2)
Programming Example: Checking Input
267(3)
Pitfall: Unexpected '\n' in Input
270(3)
The eof Member Function
273(3)
Programming Example: Editing a Text File
276(1)
Predefined Character Functions
277(3)
Pitfall: toupper and tolower Return int Values
280(3)
Inheritance
283(24)
Inheritance among Stream Classes
283(4)
Programming Example: Another new_line Function
287(1)
Default Arguments for Functions (Optional)
288(3)
Chapter Summary
291(2)
Answers to Self-Test Exercises
293(7)
Programming Projects
300(7)
Defining Classes
307(74)
Structures
308(13)
Structures for Diverse Data
309(5)
Pitfall: Forgetting a Semicolon in a Structure Definition
314(1)
Structures as Function Arguments
315(1)
Programming Tip: Use Hierarchical Structures
316(2)
Initializing Structures
318(3)
Classes
321(37)
Defining Classes and Member Functions
321(6)
Public and Private Members
327(7)
Programming Tip: Make All Member Variables Private
334(2)
Programming Tip: Define Accessor and Mutator Functions
336(2)
Programming Tip: Use the Assignment Operator with Objects
338(1)
Programming Example: Bank Account Class-Version 1
339(5)
Summary of Some Properties of Classes
344(2)
Constructors for Initialization
346(8)
Programming Tip: Always Include a Default Constructor
354(2)
Pitfall: Constructors with No Arguments
356(2)
Abstract Data Types
358(23)
Classes to Produce Abstract Data Types
359(4)
Programming Example: Alternative Implementation of a Class
363(5)
Chapter Summary
368(1)
Answers to Self-Test Exercises
369(8)
Programming Projects
377(4)
More Flow of Control
381(78)
Using Boolean Expressions
382(10)
Evaluating Boolean Expressions
382(5)
Pitfall: Boolean Expressions Convert to int Values
387(3)
Functions That Return a Boolean Value
390(1)
Enumeration Types (Optional)
391(1)
Multiway Branches
392(22)
Nested Statements
392(1)
Programming Tip: Use Braces in Nested Statements
392(3)
Multiway if-else Statements
395(3)
Programming Example: State Income Tax
398(4)
The switch Statement
402(4)
Pitfall: Forgetting a break in a switch Statement
406(1)
Using switch Statements for Menus
407(1)
Programming Tip: Use Function Calls in Branching Statements
407(1)
Blocks
407(6)
Pitfall: Inadvertent Local Variables
413(1)
More about C++ Loop Statements
414(17)
The while Statements Reviewed
415(1)
Increment and Decrement Operators Revisited
415(5)
The for Statement
420(4)
Pitfall: Extra Semicolon in a for Statement
424(2)
What Kind of Loop to Use
426(3)
Pitfall: Uninitialized Variables and Infinite Loops
429(1)
The break Statement
429(1)
Pitfall: The break Statement in Nested Loops
429(2)
Designing Loops
431(28)
Loops for Sums and Products
432(1)
Ending a Loop
433(3)
Nested Loops
436(6)
Debugging loops
442(3)
Chapter Summary
445(1)
Answers to Self-Test Exercises
446(7)
Programming Projects
453(6)
Friends and Overloaded Operators
459(58)
Friend Functions
460(26)
Programming Example: An Equality Function
460(1)
Friend Functions
461(4)
Programming Tip: Define Both Accessor Functions and Friend Functions
465(4)
Programming Tip: Use Both Member and Nonmember Functions
469(1)
Programming Example: Money Class (Version 1)
469(8)
Implementation of digit_to_int (Optional)
477(1)
Pitfall: Leading Zeros in Number Constants
478(2)
The const Parameter Modifier
480(2)
Pitfall: Inconsistent Use of const
482(4)
Overloading Operators
486(31)
Overloading Operators
486(4)
Constructors for Automatic Type Conversion
490(2)
Overloading Unary Operators
492(1)
Overloading >> and <<
493(12)
Chapter Summary
505(1)
Answers to Self-Test Exercises
506(8)
Programming Projects
514(3)
Separate Compilation and Namespaces
517(40)
Separate Compilation
518(17)
ADTs Reviewed
519(1)
Case Study: DigitalTime-A Class Compiled Separately
520(11)
Using #ifndef
531(3)
Programming Tip: Defining Other Libraries
534(1)
Namespaces
535(22)
Namespaces and using Directives
535(2)
Creating a Namespace
537(4)
Qualifying Names
541(1)
A Subtle Point About Namespaces (Optional)
542(2)
Unnamed Namespaces
544(5)
Programming Tip: Choosing a Name for a Namespace
549(1)
Pitfall: Confusing the Global Namespace and the Unnamed Namespace
550(2)
Chapter Summary
552(1)
Answers to Self-Test Exercises
553(2)
Programming Projects
555(2)
Arrays
557(86)
Introduction to Arrays
558(10)
Declaring and Referencing Arrays
559(1)
Programming Tip: Use for loops with Arrays
560(1)
Pitfall: Array Indexes Always Start with Zero
560(2)
Programming Tip: Use a Defined Constant for the Size of an Array
562(1)
Arrays in Memory
562(2)
Pitfall: Array Index Out of Range
564(1)
Initializing Arrays
565(3)
Arrays in Functions
568(25)
Indexed Variables as Function Arguments
568(3)
Entire Arrays as Function Arguments
571(3)
The const Parameter Modifier
574(2)
Pitfall: Inconsistent Use of const Parameters
576(1)
Functions That Return an Array
577(1)
Case Study: Production Graph
578(15)
Programming with Arrays
593(12)
Partially Filed Arrays
593(3)
Programming Tip: Do Not Skimp on Formal Parameters
596(1)
Programming Example: Searching an Array
597(3)
Programming Example: Sorting an Array
600(5)
Arrays and Classes
605(9)
Arrays of Classes
605(3)
Arrays as Class Members
608(3)
Programming Example: A Class for a Partially Filled Array
611(3)
Multidimensional Arrays
614(29)
Multidimensional Array Basics
615(1)
Multidimensional Array Parameters
616(1)
Programming Example: Two-Dimensional Grading Program
617(5)
Pitfall: Using Commas between Array Indexes
622(1)
Chapter Summary
623(1)
Answers to Self-Test Exercises
624(7)
Programming Projects
631(12)
Strings and Vectors
643(54)
An Array Type for Strings
645(19)
C-String Values and C-String Variables
645(4)
Pitfall: Using = and == with C Strings
649(2)
Other Functions in <cstring>
651(5)
C-String Input and Output
656(3)
C-String-to-Number Conversions and Robust Input
659(5)
The Standard string Class
664(19)
Introduction to the Standard Class string
665(2)
I/O with The Class string
667(5)
Programming Tip: More Versions of getline
672(1)
Pitfall: Mixing cin >> variable; and getline
672(2)
String Processing with the Class string
674(4)
Programming Example: Palindrome Testing
678(4)
Converting between string Objects and C Strings
682(1)
Vectors
683(14)
Vector Basics
684(3)
Pitfall: Using Square Brackets beyond the Vector Size
687(1)
Programming Tip: Vector Assignment Is Well Behaved
687(1)
Efficiency Issues
688(2)
Chapter Summary
690(1)
Answers to Self-Test Exercises
690(3)
Programming Projects
693(4)
Pointers and Dynamic Arrays
697(52)
Pointers
698(14)
Pointer Variables
699(8)
Basic Memory Management
707(1)
Pitfall: Dangling Pointers
708(1)
Static Variables and Automatic Variables
709(1)
Programming Tip: Define pointer Types
709(3)
Dynamic Arrays
712(10)
Array Variables and Pointer Variables
712(2)
Creating and Using Dynamic Arrays
714(6)
Pointer Arithmetic (Optional)
720(1)
Multidimensional Dynamic Arrays (Optional)
721(1)
Classes and Dynamic Arrays
722(27)
Programming Example: A String Variable Class
724(3)
Destructors
727(5)
Pitfall: Pointers as Call-by-Value Parameters
732(1)
Copy Constructors
732(7)
Overloading the Assignment Operator
739(3)
Chapter Summary
742(1)
Answers to Self-Test Exercises
743(2)
Programming Projects
745(4)
Recursion
749(46)
Recursive Functions for Tasks
751(14)
Case Study: Vertical Numbers
751(7)
A Closer Look at Recursion
758(1)
Pitfall: Infinite Recursion
759(3)
Stacks for Recursion
762(1)
Pitfall: Stack Overflow
763(1)
Recursion versus Iteration
764(1)
Recursive Functions for Values
765(6)
General Form for a Recursive Function That Returns a Value
765(1)
Programming Example: Another Powers Function
766(5)
Thinking Recursively
771(24)
Recursive Design Techniques
771(2)
Case Study: Binary Search-An Example of Recursive Thinking
773(8)
Programming Example: A Recursive Member Function
781(5)
Chapter Summary
786(1)
Answers to Self-Test Exercises
787(4)
Programming Projects
791(4)
Templates
795(32)
Templates for Algorithm Abstraction
796(14)
Templates for Functions
798(3)
Pitfall: Compiler Complications
801(3)
Programming Example: A Generic Sorting Function
804(5)
Programming Tip: How to Define Templates
809(1)
Pitfall: Using a Template with an Inappropriate Type
809(1)
Templates for Data Abstraction
810(17)
Syntax for Class Templates
810(4)
Programming Example: An Array Class
814(6)
Chapter Summary
820(1)
Answers to Self-Test Exercises
820(5)
Programming Projects
825(2)
Pointers and Linked Lists
827(38)
Nodes and Linked Lists
828(22)
Nodes
828(6)
Linked lists
834(1)
Inserting a Node at the Head of a List
835(4)
Pitfall: Losing Nodes
839(1)
Searching a Linked List
840(3)
Pointers as Iterators
843(1)
Inserting and Removing Nodes Inside o List
843(3)
Pitfall: Using the Assignment Operator with Dynamic Data Structures
846(4)
A Linked List Application
850(15)
Stacks
850(1)
Programming Example: A Stack Class
850(7)
Chapter Summary
857(1)
Answers to Self-Test Exercises
857(2)
Programming Projects
859(6)
Inheritance
865(58)
Inheritance Basics
866(26)
Derived Classes
867(11)
Constructors in Derived Classes
878(2)
Pitfall: Use of Private Member Variables from the Base Class
880(2)
Pitfall: Private Member Functions Are Effectively Not Inherited
882(1)
The protected Qualifier
882(3)
Redefinition of Member Functions
885(1)
Redefining versus Overloading
886(2)
Access to a Redefined Base Function
888(4)
Inheritance Details
892(4)
Functions That Are Not Inherited
892(1)
Assignment Operators and Copy Constructors in Derived Classes
893(1)
Destructors in Derived Classes
894(2)
Polymorphism
896(27)
Late Binding
896(1)
Virtual Functions in C++
897(6)
Virtual Functions and Extended Type Compatibility
903(3)
Pitfall: The Slicing Problem
906(1)
Pitfall: Not Using Virtual Member Functions
906(3)
Pitfall: Attempting to Compile Class Definitions without Definitions for Every Virtual Member Function
909(1)
Programming Tip: Make Destructors Virtual
910(2)
Chapter Summary
912(1)
Answers to Self-Test Exercises
912(5)
Programming Projects
917(6)
Exception Handling
923(32)
Exception-Handling Basics
925(22)
A Toy Example of Exception Handling
925(9)
Defining Your Own Exception Classes
934(1)
Multiple Throws and Catches
935(1)
Pitfall: Catch the More Specific Exception First
935(6)
Programming Tip: Exception Classes Can Be Trivial
941(1)
Throwing an Exception in a Function
942(1)
Exception Specification
942(4)
Pitfall: Exception Specification in Derived Classes
946(1)
Programming Techniques for Exception Handling
947(8)
When to Throw an Exception
948(1)
Pitfall: Uncaught Exceptions
949(1)
Pitfall: Nested try-catch Blocks
949(1)
Pitfall: Overuse of Exceptions
950(1)
Exception Class Hierarchies
950(1)
Testing for Available Memory
950(1)
Rethrowing an Exception
951(1)
Chapter Summary
951(1)
Answers to Self-Test Exercises
952(1)
Programming Projects
953(2)
Appendix 1 C++ Keywords 955(1)
Appendix 2 Precedence of Operators 956(2)
Appendix 3 The ASCII Character Set 958(1)
Appendix 4 Some Library Functions 959(8)
Appendix 5 The assert Statement 967(2)
Appendix 6 Inline Functions 969(1)
Appendix 7 Overloading the Array Index Square Brackets 970(2)
Appendix 8 The this Pointer 972(3)
Appendix 9 Overloading Operators as Member Operators 975(2)
Index 977

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