ISBN-10:
0132162733
ISBN-13:
2900132162738
Pub. Date:
03/18/2011
Publisher:
Pearson
Problem Solving with C++ / Edition 8

Problem Solving with C++ / Edition 8

by Walter Savitch
Current price is , Original price is $150.2. You
  • $30.04 $150.20 Save 80% Current price is $30.04, Original price is $150.2. You Save 80%.
    Note: Access code and/or supplemental material are not guaranteed to be included with textbook rental or used textbook.

    Temporarily Out of Stock Online

    Please check back later for updated availability.

  • This Item is Not Available

  • Product Details

    ISBN-13: 2900132162738
    Publisher: Pearson
    Publication date: 03/18/2011
    Series: MyprogrammingLab Series
    Edition description: Older Edition
    Pages: 1056
    Product dimensions: 6.00(w) x 1.25(h) x 9.00(d)

    About the Author

    Walter Savitch is Professor Emeritus of Computer Science at the University of California at San Diego. His interests include complexity theory, formal language theory, computational linguistics, and the development of computer science education materials, including several leading textbooks. He holds a PhD in mathematics from the University of California at Berkeley.

    Table of Contents

    1. Introduction to Computers and C++ Programming.
    Computer Systems.
    Hardware.
    Software.
    High-Level Languages.
    Compilers.
    Self-Test Exercises.
    History Note.
    Programming and Problem-Solving.
    Algorithms.
    Program Design.
    The Software Life Cycle.
    Self-Test Exercises.
    Introduction to C++.
    Origins of the C++ Language.
    A Sample C++ Program.
    Pitfall: Using the Wrong Slash in \n.
    Programming Tip: Input and Output Syntax.
    Layout of a Simple C++ Program.
    Compiling and Running a C++ Program.
    Self-Test Exercises.
    Testing and Debugging.
    Kinds of Program Errors.
    Pitfall: Assuming Your Program Is Correct.
    Self-Test Exercises.
    Chapter Summary.
    Answers to Self-Test Exercises.
    Programming Projects.

    2. C++ Basics.
    Variables and Assignments.
    Variables.
    Names: Identifiers.
    Variable Declarations.
    Assignment Statements.
    Pitfall: Uninitialized Variables.
    Programming Tip: Use Meaningful Names.
    Self-Test Exercises.
    Input and Output.
    Output Using cout.
    Programming Tip: End Each Program with a \n or endl.
    Formatting for Numbers with a Decimal Point.
    Input Using cin.
    Designing Input and Output.
    Programming Tip: Line Breaks in I/O.
    Self-Test Exercises.
    Data Types and Expressions.
    The Types int and double.
    Other Number Types.
    The Type char.
    Type Compatibilities.
    Arithmetic Operators and Expressions.
    Pitfall: Whole Numbers in Division.
    Self-Test Exercises.
    More Assignment Statements.
    Simple Flow of Control.
    A Simple Branching Mechanism.
    Pitfall: Strings of Inequalities.
    Pitfall: Using = in place of ==.
    Compound Statements.
    Self-Test Exercises.
    Simple Loop Mechanisms.
    Increment and Decrement Operators.
    Programming Example: Charge Card Balance.
    Pitfall: Infinite Loops.
    Self-Test Exercises.
    Program Style Indenting.
    Comments.
    Naming Constants.
    Self-Test Exercises.
    Chapter Summary.
    Answers to Self-Test Exercises.
    Programming Projects.

    3. Procedural Abstraction and Functions That Return a Value.
    Top-Down Design.
    Predefined Functions.
    Using Predefined Functions.
    Type Changing Functions.
    Self-Test Exercises.
    Programmer-Defined Functions.
    Function Definitions.
    Alternate Form for Function Prototypes.
    Pitfall: Arguments in the Wrong Order.
    Function Definition-Syntax Summary.
    More About Placement of Function Definitions.
    Self-Test Exercises.
    Procedural Abstraction.
    The Black Box Analogy.
    Programming Tip: Choosing Formal Parameter Names.
    Case Study: Buying Pizza.
    Programming Tip: Use Pseudocode.
    Self-Test Exercises.
    Local Variables.
    The Small Program Analogy.
    Programming Example: Experimental Pea Patch.
    Global Constants and Global Variables.
    Call-by-Value Formal Parameters Are Local Variables.
    Self-Test Exercises.
    Programming Example: The Factorial Function.
    Overloading Function Names.
    Introduction to Overloading.
    Programming Example: Revised Pizza-Buying Program.
    Automatic Type Conversion.
    Self-Test Exercises.
    Chapter Summary.
    Answers to Self-Test Exercises.
    Programming Projects.

    4. Functions for All Subtasks.
    void-Functions.
    Definitions of void-Functions.
    Programming Example: Converting Temperatures from Fahrenheit to Celsius.
    Return-Statements in void-Functions.
    Self-Test Exercises.
    Call-by-Reference Parameters.
    A First View of Call-by-Reference.
    Call-by-Reference in Detail.
    Programming Example: The swap_values Function.
    Mixed Parameter Lists.
    Programming Tip: What Kind of Parameter to Use.
    Pitfall: Inadvertent Local Variables.
    Self-Test Exercises.
    Using Procedural Abstraction.
    Functions Calling Functions.
    Preconditions and Postconditions.
    Case Study: Supermarket Pricing.
    Self-Test Exercises.
    Testing and Debugging Functions.
    Stubs and Drivers.
    Self-Test Exercises.
    Chapter Summary.
    Answers to Self-Test Exercises.
    Programming Projects.

    5. I/O Streams as an Introduction to Objects and Classes.
    Streams and Basic File I/O.
    Why Use Files for I/O?
    File I/O.
    Introduction to Classes and Objects.
    Programming Tip: Check that a File Was Opened Successfully.
    Techniques for File I/O.
    Self-Test Exercises.
    File Names as Input (Optional).
    Tools for Stream I/O.
    Formatting Output with Stream Functions.
    Manipulators.
    Self-Test Exercises.
    Streams as Arguments to Functions.
    Programming Tip: Checking for the End of a File.
    Programming Example: Cleaning Up a File Format.
    Self-Test Exercises.
    Character I/O.
    The Member Functions get and put.
    The putback Member Function (Optional).
    Programming Example: Checking Input.
    Pitfall: Unexpected '\n' in Input.
    The eof Member Function.
    Self-Test Exercises.
    Programming Example: Editing a Text File.
    Predefined Character Functions.
    Pitfall: toupper and tolower Return int Values.
    Self-Test Exercises.
    Inheritance.
    Inheritance Among Stream Classes.
    Programming Example: Another new_line Function.
    Self-Test Exercises.
    Chapter Summary.
    Answers to Self-Test Exercises.
    Programming Projects.

    6. Defining Classes and Abstract Data Types.
    Structures.
    Structures for Diverse Data.
    Pitfall: Forgetting a Semicolon in a Structure Definition.
    Structures as Function Arguments.
    Programming Tip: Use Hierarchical Structures.
    Initializing Structures.
    Self-Test Exercises.
    Classes.
    Defining Classes and Member Functions.
    Self-Test Exercises.
    Public and Private Members.
    Programming Tip: Make All Member Variables Private.
    Programming Tip: Define Accessor Functions.
    Programming Tip: Use the Assignment Operator with Objects.
    Self-Test Exercises.
    Programming Example: Bank Account Class, Version 1.
    Summary of Some Properties of Classes.
    Self-Test Exercises.
    Constructors for Initialization.
    Programming Tip: Always Include a Default Constructor.
    Pitfall: Constructors with No Arguments.
    Self-Test Exercises.
    Abstract Data Types.
    Classes to Produce ADTs.
    Programming Example: Alternative Implementation of a Class.
    Self-Test Exercises.
    Chapter Summary.
    Answers to Self-Test Exercises.
    Programming Projects.

    7. More Flow of Control.
    Using Logical Expressions.
    Evaluating Logical Expressions.
    Pitfall: Logical Expressions Produce int Values.
    Self-Test Exercises.
    Programming Tip: Define TRUE and FALSE.
    Functions That Return a Logical Value.
    Self-Test Exercises.
    Enumeration Types (Optional).
    Multiway Branches.
    Nested Statements.
    Programming Tip: Use Braces in Nested Statements.
    Multiway if-else-Statements.
    Programming Example: State Income Tax.
    Self-Test Exercises.
    The switch-Statement.
    Pitfall: Forgetting a break in a switch-Statement.
    Using switch-Statements for Menus.
    Programming Tip: Use Function Calls in Branching Statements.
    Blocks.
    Pitfall: Inadvertent Local Variables.
    Self-Test Exercises.
    More About C++ Loop Statements.
    The while-statements Reviewed.
    Increment and Decrement Operators Revisited.
    Self-Test Exercises.
    The for-Statement.
    Pitfall: Extra Semicolon in a for-Statement.
    What Kind of Loop to Use.
    Self-Test Exercises.
    Pitfall: Uninitialized Variables and Infinite Loops.
    The break-Statement.
    Pitfall: The break-Statement in Nested Loops.
    Self-Test Exercises.
    Designing Loops.
    Loops for Sums and Products.
    Ending a Loop.
    Nested Loops.
    Self-Test Exercises.
    Debugging Loops.
    Self-Test Exercises.
    Chapter Summary.
    Answers to Self-Test Exercises.
    Programming Projects.

    8. Tools For Defining ADTs.
    Defining ADT Operations.
    Programming Example: An Equality Function.
    Self-Test Exercise.
    Friend Functions.
    Programming Tip: Define Both Accessor Functions and Friend Functions.
    Programming Tip: Use Both Member and Nonmember Functions.
    Programming Example: Money ADT (Version 1).
    Implementation of digit_to_int (Optional).
    Pitfall: Leading Zeros in Number Constants.
    Self-Test Exercises.
    The const Parameter Modifier.
    Pitfall: Inconsistent Use of const.
    Self-Test Exercises.
    Overloading Operators.
    Self-Test Exercises.
    Constructors for Automatic Type Conversion.
    Self-Test Exercise.
    Overloading Unary Operators.
    Overloading ›› and <<.
    Self-Test Exercise.
    Separate Compilation.
    ADTs Reviewed.
    Case Study: DigitalTime-An ADT Compiled Separately.
    Programming Tip: Hiding the Helping Functions.
    Using #ifndef.
    Programming Tip: Choosing ADT Operations.
    Programming Tip: Defining Other Libraries.
    Self-Test Exercises.
    Chapter Summary.
    Answers to Self-Test Exercises.
    Programming Projects.

    9. Arrays.
    Introduction to Arrays.
    Declaring and Referencing Arrays.
    Programming Tip: Use for-Loops with Arrays.
    Arrays in Memory.
    Pitfall: Array Index Out of Range.
    Initializing Arrays.
    Self-Test Exercises.
    Arrays in Functions.
    Indexed Variables as Function Arguments.
    Pitfall: Array Indexes Always Start with Zero.
    Programming Tip: Use a Defined Constant for the Size of an Array.
    Self-Test Exercises.
    Entire Arrays as Function Arguments.
    The const Parameter Modifier.
    Self-Test Exercises.
    Programming with Arrays.
    Case Study: Production Graph.
    Partially Filled Arrays.
    Programming Example: Searching an Array.
    Programming Tip: Do Not Skimp on Formal Parameters.
    Programming Example: Sorting an Array.
    Self-Test Exercises.
    Arrays and Classes.
    Arrays of Classes.
    Self-Test Exercises.
    Arrays as Class Members.
    Programming Example: A Class for a Partially Filled Array.
    Self-Test Exercises.
    Chapter Summary.
    Answers to Self-Test Exercises.
    Programming Projects.

    10. Strings and Multidimensional Arrays.
    String Basics.
    String Values and String Variables.
    Pitfall: Using = and == with Strings.
    Predefined String Functions.
    Pitfall: Dangers in Using string.h.
    Self-Test Exercises.
    Defining String Functions.
    String Input and Output.
    String-to-Number Conversions and Robust Input.
    Self-Test Exercises.
    Multidimensional Arrays.
    Multidimensional Array Basics.
    Programming Example: Two-dimensional Grading Program.
    Arrays of Strings.
    Self-Test Exercises.
    STL Strings.
    Interface for STL Strings.
    Implementation of STL Strings.
    Arrays of Strings Revisited.
    Self-Test Exercises.
    Chapter Summary.
    Answers to Self-Test Exercises.
    Programming Projects.

    11. Pointers and Dynamic Arrays.
    Pointers.
    Pointer Variables.
    Self-Test Exercises.
    Basic Memory Management.
    Pitfall: Dangling Pointers.
    Static, Dynamic, and Automatic Variables.
    Programming Tip: Define Pointer Types.
    Self-Test Exercises.
    Dynamic Arrays.
    Array Variables and Pointer Variables.
    Creating and Using Dynamic Arrays.
    Self-Test Exercises.
    Pointer Arithmetic (Optional).
    Classes and Dynamic Arrays.
    Programming Example: A String Variable Class Destructors.
    Pitfall: Pointers as Call-by-Value Parameters Copy Constructors.
    Self-Test Exercises.
    Overloading the Assignment Operator (Optional).
    Chapter Summary.
    Answers to Self-Test Exercises.
    Programming Projects.

    12. Recursion.
    Recursive Functions for Tasks.
    Case Study: Vertical Numbers.
    A Closer Look at Recursion.
    Pitfall: Infinite Recursion.
    Self-Test Exercises.
    Stacks for Recursion.
    Pitfall: Stack Overflow.
    Recursion versus Iteration.
    Self-Test Exercises.
    Recursive Functions for Values.
    General Form for a Recursive Function That Returns a Value.
    Programming Example: Another Powers Function.
    Self-Test Exercises.
    Thinking Recursively.
    Recursive Design Techniques.
    Case Study: Binary Search-An Example- Recursive Thinking.
    Programming Example: A Recursive Member Function.
    Self-Test Exercises.
    Chapter Summary.
    Answers to Self-Test Exercises.
    Programming Projects.

    13. Templates for More Abstraction.
    Templates for Algorithm Abstraction.
    Templates for Functions.
    Pitfall: Compiler Complications.
    Self-Test Exercises.
    Programming Example: A Generic Sorting Function.
    Programming Tip: How to Define Templates.
    Self-Test Exercise.
    Templates for Data Abstraction.
    Syntax for Class Templates.
    Programming Example: An Array Class.
    Self-Test Exercises.
    Chapter Summary.
    Answers to Self-Test Exercises.
    Programming Projects.

    14. Pointers and Linked Lists.
    Nodes and Linked Lists.
    Nodes.
    Self-Test Exercises.
    Linked Lists.
    Inserting a Node at the Head of a List.
    Pitfall: Losing Nodes.
    Searching a Linked List.
    Inserting and Removing Nodes Inside a List.
    Pitfall: Using the Assignment Operator with Dynamic Data Structures.
    Self-Test Exercises.
    A Linked List Application.
    Stacks.
    Programming Example: A Stack ADT.
    Self-Test Exercises.
    Chapter Summary.
    Answers to Self-Test Exercises.
    Programming Projects.

    15. Inheritance.
    Inheritance Basics.
    The Notion of Inheritance.
    Derived Classes.
    Programming Tip: A Derived Class Has More Than One Type.
    Self-Test Exercises.
    Programming with Inheritance.
    Overriding Function Definitions.
    Virtual Functions (Optional).
    Self-Test Exercises.
    Chapter Summary.
    Answers to Self-Test Exercises.
    Programming Projects.

    Appendices.
    Appendix 1: C++ Keywords.
    Appendix 2: Precedence of Operators.
    Appendix 3: The ASCII Character Set.
    Appendix 4: Some Library Functions.
    Appendix 5: The assert-Statement.
    Appendix 6: Inline Functions.
    Appendix 7: Constructor Initialization Section.
    Appendix 8: Overloading the Array Index Square.
    Appendix 9: The this Pointer.
    Appendix 10: Derived Classes and Inheritance.

    Index.

    Customer Reviews

    Most Helpful Customer Reviews

    See All Customer Reviews

    Problem Solving with C++ 0 out of 5 based on 0 ratings. 0 reviews.