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.

9780201357493

Problem Solving With C++ : The Object of Programming

by
  • ISBN13:

    9780201357493

  • ISBN10:

    0201357496

  • Edition: 1st
  • Copyright: 1998-08-01
  • Publisher: ADDISON WESLEY LONGMAN INC
  • 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: $72.00 Save up to $0.36
  • Buy New
    $71.64
    Add to Cart Free Shipping Icon Free Shipping

    USUALLY SHIPS IN 2-3 BUSINESS DAYS

Supplemental Materials

What is included with this book?

Summary

Since its publication in 1995, Walter Savitch's Problem Solving with C++ has become the leading book for the Introductory Programming in C++ course, with the number of schools using it increasing every semester. Now in its second edition, the text includes the most current C++ developments, such as the new type bool and the STL string class. Students learn to design their own classes from the beginning, so that by the end of Chapter 8, they can write realistic class definitions. The modular organization of the book allows instructors to tailor both topic selection and presentation to meet the needs of their courses. Finally, the book features Professor Savitch's friendly, motivational writing style and helpful learning aids that have made it so popular among students. Book jacket.

Author Biography

Walter J. Savitch is a Professor of Computer Science at the University of California at San Diego where he has been one of the main designers of the computer science curriculum. A well-known and respected author, he has written widely on complexity theory and on computational linguistics, and published a textbook on computability theory. Professor Savitch's extensive teaching experience is captured in his innovative and successful series of introductory programming texts: An Introduction To The Art and Science of Programming, available in Turbo Pascal, Standard Pascal, and Ada, and Data Structures and Other Objects Using C++.

Table of Contents

CHAPTER 1 INTRODUCTION TO COMPUTERS AND C++ PROGRAMMING
1(36)
1.1 Computer Systems
2(11)
Hardware
2(5)
Software
7(1)
High-Level Languages
8(1)
Compilers
9(2)
Self-Test Exercises
11(1)
History Note
12(1)
1.2 Programming and Problem-Solving
13(6)
Algorithms
14(1)
Program Design
15(2)
The Software Life Cycle
17(1)
Self-Test Exercises
18(1)
1.3 Introduction to C++
19(9)
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
24(1)
Pitfall-Putting a Space before the Include File Name
24(1)
Layout of a Simple C++ Program
25(2)
Compiling and Running a C++ Program
27(1)
Self-Test Exercises
28(1)
1.4 Testing and Debugging
28(3)
Kinds of Program Errors
29(1)
Pitfall-Assuming Your Program Is Correct
30(1)
Self-Test Exercises
30(1)
Chapter Summary
31(1)
Answers to Self-Test Exercises
32(2)
Programming Projects
34(3)
CHAPTER 2 C++ BASIC
37(68)
2.1 Variables and Assignments
38(10)
Variables
39(3)
Names: Identifiers
39(3)
Variable Declarations
42(2)
Assignment Statements
44(2)
Pitfall-Uninitialized Variables
46(1)
Programming Tip-Use Meaningful Names
47(1)
Self-Test Exercises
47(1)
2.2 Input and Output
48(9)
Output Using cout
48(2)
Escape Sequences
50(2)
Programming Tip-End Each Program with a\n or endxxx
52(1)
Formating for Numbers with a Decimal Point
52(2)
Input Using cin
54(1)
Designing Input and Output
55(1)
Programming Tip-Line Breaks in I/O
56(1)
Self-Test Exercises
56(1)
2.3 Data Types and Expressions
57(13)
The Types int and double
57(2)
Other Number Types
59(2)
The Type Char
61(1)
The Type booxxx
62(1)
Type Compatibilities
62(2)
Arithmetic Operators and Expressions
64(3)
Pitfall-Whole Numbers in Division
67(1)
Self-Test Exercises
68(1)
More Assignment Statements
69(1)
2.4 Simple Flow of Control
70(20)
A Simple Branching Mechanism
70(6)
Pitfall-Strings of Inequalities
76(1)
Pitfall-Using=in place of
76(2)
Compound Statements
78(1)
Self-Test Exercises
79(1)
Simple Loop Mechanisms
80(4)
Increment and Decrement Operators
84(2)
Programming Example-Charge Card Balance
86(1)
Pitfall-Infinite Loops
87(2)
Self-Test Exercises
89(1)
2.5 Program Style
90(5)
Indenting
90(1)
Comments
91(1)
Naming Constants
92(3)
Self-Test Exercises
95(1)
Chapter Summary
95(1)
Answers to Self-Test Exercises
96(5)
Programming Projects
101(4)
CHAPTER 3 PROCEDURAL ABSTRACTION AND FUNCTIONS THAT RETURN A VALUE
105(62)
3.1 Top-Down Design
106(1)
3.2 Predefined Functions
107(9)
Using Predefined Functions
107(5)
Type Changing Functions
112(3)
Self-Test Exercises
115(1)
3.3 Programmer-Defined Functions
116(11)
Function Definitions
116(5)
Alternate Form for Function Prototypes
121(2)
Pitfall-Arguments in the Wrong Order
123(2)
Function Definition-Syntax Summary
125(1)
More About Placement of Function Definitions
126(1)
Self-Test Exercises
127(1)
3.4 Procedural Abstraction
127(12)
The Black Box Analogy
128(2)
Programming Tip-Choosing Formal Parameter Names
130(1)
Case Study-Buying Pizza
131(7)
Programming Tip-Use Pseudocode
138(1)
Self-Test Exercises
138(1)
3.5 Local Variables
139(11)
The Small Program Analogy
139(3)
Programming Example-Experimental Pea Patch
142(1)
Global Constants and Global Variables
142(3)
Call-by-Value Formal Parameters Are Local Variables
145(2)
Self-Test Exercises
147(1)
Programming Example-The Factorial Function
148(2)
3.6 Overloading Function Names
150(8)
Introduction to Overloading
150(3)
Programming Example-Revised Pizza-Buying Program
153(1)
Automatic Type Conversion
154(4)
Self-Test Exercises
158(1)
Chapter Summary
158(1)
Answers to Self-Test Exercises
159(3)
Programming Projects
162(5)
CHAPTER 4 FUNCTIONS FOR ALL SUBTASKS
167(48)
4.1 void-Functions
168(8)
Definitions of Void-Functions
168(3)
Programming Example-Converting Temperatures from Fahrenheit to Celsius
171(1)
return-Statements in void-Functions
171(3)
Self-Test Exercises
174(2)
4.2 Call-by-Reference Parameters
176(14)
A First View of Call-by-Reference
176(3)
Call-by-Reference in Detail
179(2)
Programming Example-The swap_values Function
181(3)
Mixed Parameter Lists
184(1)
Programming Tip-What Kind of Parameter to Use
185(2)
Pitfall-Inadvertent Local Variables
187(2)
Self-Test Exercises
189(1)
4.3 Using Procedural Abstraction
190(10)
Functions Calling Functions
190(3)
Preconditions and Postconditions
193(1)
Case Study-Supermarket Pricing
194(3)
Self-Test Exercises
197(3)
4.4 Testing and Debugging Functions
200(6)
Stubs and Drivers
200(3)
Self-Test Exercises
203(3)
Chapter Summary
206(1)
Answers to Self-Test Exercises
207(3)
Programming Projects
210(5)
CHAPTER 5 I/O STREAMS AS AN INTRODUCTION TO OBJECTS AND CLASSES
215(76)
5.1 Streams and Basic File I/O
216(16)
Why Use Files for I/O?
217(1)
File I/O
218(3)
Introduction to Classes and Objects
221(4)
Programming Tip-Check that a File Was Opened Successfully
225(3)
Techniques for File I/O
228(2)
Self-Test Exercises
230(1)
File Names as Input (Optional)
230(2)
5.2 Tools for Stream I/O
232(16)
Formatting Output with Stream Functions
235(3)
Manipulators
238(2)
Self-Test Exercises
240(2)
Streams as Arguments to Functions
242(1)
Programming Tip-Checking for the End of File
242(4)
Programming Example-Cleaning Up a File Format
246(1)
Self-Test Exercises
247(1)
5.3 Character I/O
248(20)
The Member Functions get and put
248(4)
The putback Member Function (Optional)
252(1)
Programming Example-Checking Input
253(1)
Pitfall-Unexpected '\n' in Input
253(1)
The eof Member Function
257(2)
Self-Test Exercises
259(2)
Programming Example-Editing a Text File
261(1)
Predefined Character Functions
262(3)
Pitfall-toupper and tolower Return int Values
265(2)
Self-Test Exercises
267(1)
5.4 Inheritance
268(8)
Inheritance Among Stream Classes
268(4)
Programming Example-Another new_line Function
272(1)
Default Arguments for Functions (Optional)
272(2)
Self-Test Exercises
274(2)
Chapter Summary
276(2)
Answers to Self-Test Exercises
278(6)
Programming Projects
284(7)
CHAPTER 6 DEFINING CLASSES AND ABSTRACT DATA TYPES
291(66)
6.1 Structures
292(13)
Structures for Diverse Data
292(6)
Pitfall-Forgetting a Semicolon in a Structure Definition
298(1)
Structures as Function Arguments
299(2)
Programming Tip-Use Hierarchical Structures
301(1)
Initializing Structures
302(1)
Self-Test Exercises
302(3)
6.2 Classes
305(32)
Defining Classes and Member Functions
305(4)
Self-Test Exercises
309(2)
Public and Private Members
311(6)
Programming Tip-Make All Member Variables Private
317(1)
Programming Tip-Define Accessor Functions
317(2)
Programming Tip-Use the Assignment Operator with Objects
319(1)
Self-Test Exercises
319(2)
Programming Example-Bank Account Class-Version l
321(5)
Summary of Some Properties of Classes
326(1)
Self-Test Exercises
327(1)
Constructors for Initialization
328(5)
Programming Tip-Always Include a Default Constructor
333(2)
Pitfall-Constructors with No Arguments
335(1)
Self-Test Exercises
336(1)
6.3 Abstract Data Types
337(9)
Classes to Produce ADTs
337(4)
Programming Example-Alternative Implementation of Class
341(5)
Self-Test Exercises
346(1)
Chapter Summary
346(1)
Answers to Self-Test Exercises
347(5)
Programming Projects
352(5)
CHAPTER 7 MORE FLOW OF CONTROL
357(76)
7.1 Using Boolen Expressions
358(9)
Evaluating Boolen Expressions
358(5)
Pitfall-Boolean Expressions Convert to int Values
363(2)
Self-Test Exercises
365(1)
Functions That Return a Boolean Value
365(1)
Self-Test Exercises
366(1)
Enumeration Types (Optional)
366(1)
7.2 Multiway Branches
367(22)
Nested Statements
368(1)
Programming Tip-Use Braces in Nested Statements
368(3)
Multiway if-else-Statements
371(1)
Programming Example-State Income Tax
372(3)
Self-Test Exercises
375(2)
The switch-statement
377(4)
Pitfall-Forgetting a break in a switch-Statement
381(1)
Using switch-Statements for Menus
381(3)
Programming Tip-Use Function Calls in Branching Statements
384(1)
Blocks
384(3)
Pitfall-Inadvertent Local Variables
387(1)
Self-Test Exercises
388(1)
7.3 More About C++ Loop Statements
389(17)
The while-Statement Reviewed
390(1)
Increment and Decrement Operators Revisited
390(4)
Self-Test Exercises
394(1)
The for-Statement
395(4)
Pitfall-Extra Semicolon in a For-Statement
399(2)
What Kind of Loop to Use
401(1)
Self-Test Exercises
402(1)
Pitfall-Uninitialized Variables and Infinite Loops
403(1)
The break-Statement
404(1)
Pitfall-The Break-Statement in Nested Loops
404(1)
Self-Test Exercises
404(2)
7.4 Designing Loops
406(13)
Loops for Sums and Products
406(2)
Ending a Loop
408(3)
Nested Loops
411(5)
Self-Test Exercises
416(1)
Debugging Loops
416(3)
Self-Test Exercises
419(1)
Chapter Summary
419(2)
Answers to Self-Test Exercises
421(7)
Programming Projects
428(5)
CHAPTER 8 TOOLS FOR DEFINING ADTs
433(78)
8.1 Defining ADT Operations
434(44)
Programming Example-An Equality Function
434(4)
Self-Test Exercise
438(1)
Friend Functions
438(1)
Programming Tip-Define Both Accessor Functions and Friend Functions
439(3)
Programming Tip-Use Both Member and Nonmember Functions
442(1)
Programming Example-Money ADT (Version 1)
443(7)
Implementation of digit_to_int (Optional)
450(1)
Pitfall-Leading Zeros in Number Constants
451(1)
Self-Test Exercises
451(2)
The const Parameter Modifier
453(3)
Pitfall-Inconsistent Use of const
456(1)
Self-Test Exercises
456(2)
Overloading Operators
458(4)
Self-Test Exercises
462(1)
Constructors for Automatic Type Conversion
462(3)
Self-Test Exercises
465(1)
Overloading Unary Operators
465(1)
Overloading Greater than Greater than and Less than Less than
466(11)
Self-Test Exercise
477(1)
8.2 Separate Compilation
478(18)
ADTs Reviewed
478(1)
Case Study-Digital Time-An ADT Compiled Separately
479(10)
Programming Tip-Hiding the Helping Functions
489(2)
Using #ifndef
491(2)
Programming Tip-Choosing ADT Operations
493(2)
Programming Tip-Defining Other Libraries
495(1)
Self-Test Exercises
495(1)
Chapter Summary
496(1)
Answers to Self-Test Exercises
497(8)
Programming Projects
505(6)
CHAPTER 9 ARRAYS
511(76)
9.1 Introduction to Arrays
512(11)
Declaring and Referencing Arrays
513(3)
Programming Tip-Use for-Loops with Arrays
516(1)
Arrays in Memory
517(1)
Pitfall-Array Index Out of Range
518(2)
Intializing Arrays
520(1)
Self-Test Exercises
521(2)
9.2 Arrays in Functions
523(12)
Indexed Variables as Function Arguments
523(1)
Pitfall-Array Indexes Always Start with Zero
524(1)
Programming Tip-Use a Defined Constant for the Size of an Array
524(2)
Self-Test Exercises
526(1)
Entire Arrays as Functions Arguments
526(4)
The const Paramenter Modifier
530(3)
Self-Test Exercisess
533(2)
9.3 Programming with Arrays
535(25)
Case Study-Production Graph
535(10)
Partially Filled Arrays
545(4)
Programming Example-Searching an Array
549(3)
Programming Tip-Do Not Skimp on Formal Parameters
552(3)
Programming Example-Sorting an Array
555(2)
Self-Test Exercises
557(3)
9.4 Arrays and Classes
560(10)
Arrays of Classes
560(2)
Self-Test Exercises
562(1)
Arrays as Class Members
562(4)
Programming Example-A Class for a Partially Filled Array
566(3)
Self-Test Exercises
569(1)
Chapter Summary
570(1)
Answers to Self-Test Exercises
571(7)
Programming Projects
578(9)
CHAPTER 10 STRINGS AND MULTIDIMENSIONAL ARRAYS
587(66)
10.1 String Basics
588(22)
Cstring Values and Cstring Variables
588(4)
Pitfall-Using = and == with Cstrings
592(2)
Predefined Cstring Functions
594(2)
Pitfall-Dangers in Using Functions from [cstring] or [string. h]
596(1)
Self-Test Exercises
596(2)
Defining Cstring Functions
598(3)
Cstring Input and Output
601(2)
Cstring-to-Number Conversions and Robust Input
603(6)
Self-Test Exercises
609(1)
10.2 Multidimensional Arrays
610(9)
Multidimensional Array Basics
610(2)
Programming Examples-Two-dimensional Grading Program
612(5)
Arrays of Cstrings
617(1)
Self-Test-Exercises
617(2)
10.3 The C++ Standard string Class
619(15)
Interface for the Standard Class String
620(5)
Pitfall-Code That Depends on Order of Evaluation is Illegal
625(1)
Programming Tip-The Ignore Member Function
625(1)
Pitfall-Mixing cin Greater than Greater than variable and get XXX ine Can Lose Input
626(1)
Programming Example-Palindrome Testing
626(8)
Arrays of Strings Revisited
634(1)
Self-Test Exercises
634(1)
Chapter Summary
634(1)
Answers to Self-Test Exercises
635(7)
Programming Projects
642(11)
CHAPTER 11 POINTERS AND DYNAMIC ARRAYS
653(48)
11.1 Pointers
654(15)
Pointer Variables
655(7)
Self-Test Exercises
662(1)
Basic Memory Management
663(2)
Pitfall-Dangling Pointers
665(1)
Static, Dynamic, and Automatic Variables
666(1)
Programming Tip-Define Pointer Types
667(2)
Self-Test Exercises
669(1)
11.2 Dynamic Arrays
669(8)
Array Variables and Pointer Variables
669(2)
Creating and Using Dynamic Arrays
671(5)
Self-Test Exercises
676(1)
Pointer Arithmetic (Optional)
676(1)
11.3 Classes and Dynamic Arrays
677(19)
Programming Example-A String Variable Class
678(6)
Destructors
684(2)
Pitfall-Pointers as Call-by-Value Paramenters
686(1)
Copy Constructors
686(6)
Self-Test Exercises
692(1)
Overloading the Assignment Operator
693(3)
Self-Test Exercises
696(1)
Chapter Summary
696(1)
Answers to Self-Test Exercises
697(3)
Programming Projects
700(1)
CHAPTER 12 RECURSION
701(48)
12.1 Recursive Functions for Tasks
703(15)
Case Study-Vertical Numbers
703(8)
A Closer Look at Recursion
711(1)
Pitfall-Infinite Recursion
712(1)
Self-Test Exercises
713(1)
Stacks for Recursion
714(2)
Pitfall-Stack Overflow
716(1)
Recurasion Versus Iteration
716(1)
Self-Test Exercises
717(1)
12.2 Recursive Functions for Values
718(6)
General Form for a Recursive Function That Returns a Value
718(1)
Programming Example-Another Powers Function
718(4)
Self-Test Exercises
722(2)
12.3 Thinking Recursively
724(15)
Recursive Design Techniques
724(1)
Case Study-Binary Search-An Example of Recursive Thinking
725(10)
Programming Example-A Recursive Member Function
735(4)
Self-Test Exercises
739(1)
Chapter Summary
739(1)
Answers to Self-Test Exercises
739(6)
Programming Projects
745(4)
CHAPTER 13 TEMPLATES MORE ABSTRACTION
749(28)
13.1 Templates for Algorithm Abstraction
750(12)
Templates for Functions
753(1)
Pitfall-Compiler Complications
754(2)
Self-Test Exercises
756(1)
Programming Example-A Generic Sorting Function
757(5)
Programming Tip-How to Define Templates
762(1)
Self-Test Exercise
762(1)
13.2 Templates for Data Abstraction
762(9)
Syntax for Class Templates
762(4)
Programming Example-An Array Class
766(5)
Self-Test Exercises
771(1)
Chapter Summary
771(1)
Answers to Self-Test Exercises
772(2)
Programming Projects
774(3)
CHAPTER 14 POINTERS AND LINKED LISTS
777(38)
14.1 Nodes and Linked Lists
778(21)
Nodes
778(4)
Self-Test-Exercises
782(2)
Linked Lists
784(1)
Inserting a Node at the Head of a List
785(4)
Pitfall-Losing Nodes
789(1)
Searching a Linked List
789(4)
Inserting and Removing Nodes Inside a List
793(5)
Pitfall-Using the Assignment Operator with Dynamic Data Structures
798(1)
Self-Test Exercises
798(1)
14.2 A Linked List Application
799(7)
Stacks
800(1)
Programming Example-A Stack ADT
800(6)
Self-Test Exercises
806(1)
Chapter Summary
806(1)
Answers to Self-Test Exercises
807(3)
Programming Projects
810(5)
CHAPTER 15 INHERITANCE
815(46)
15.1 Inheritance Basics
816(18)
The Notation of Inheritance
817(1)
Constructor Base Initialization List
817(3)
Derived Classes
820(2)
Redefinition of Member Functions
822(7)
Self-Test-Exercises
829(5)
15.2 Programming with Inheritance
834(19)
Self-Test Exercises
839(1)
Overloading, Overriding, Redefinition (Optional)
839(2)
Virtual Functions and Extended Type Compatability
841(5)
Pitfall-The Slicing Problem
846(1)
Pitfall-Not Using Virutal Member Functions
846(1)
Pitfall-Attempting to Compile Class Definitions without Definitions for Every Virtual Member Function
847(1)
Programming Example
848(5)
Self-Test Exercises
853(1)
Chapter Summary
853(1)
Answers to Self-Test Exercises
853(4)
Programming Projects
857(4)
Appendix 1 C++ Keywords 861(1)
Appendix 2 Precedence of Operators 862(2)
Appendix 3 The ASCII Character Set 864(1)
Appendix 4 Some Library Functions 865(8)
Arithmetic Functions 865(1)
Input and Output Member Functions 866(2)
Character Functions 868(1)
String Functions 869(2)
Random Number Generator 871(1)
Trigonometric Functions 872(1)
Appendix 5 The assert-Statement 873(2)
Appendix 6 Inline Functions 875(1)
Appendix 7 Constructor Initialization Section 876(2)
Appendix 8 Overloading the Array Index Square Brackets 878(2)
Appendix 9 The this Pointer 880(3)
Appendix 10 Simulating the bool Type 883(2)
Annotated Bibliography for C++ Language and Library Issues 885(4)
Index 889

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