Computing Fundamentals with C++: 3rd Edition View larger

Computing Fundamentals with C++: 3rd Edition

9781590282762

New product

Author: Rick Mercer

Copyright: 2018

Binding: Paperback

Page Count: 448

More details

$60.00

More info

This long-awaited update to Rick Mercer’s introductory  book, first published in 1993, is written for students in a first course in a Computer Science curriculum using the C++ programming language. It is appropriate for students with no programming experience as well as those with programming experience in another language.

Computing Fundamentals with C++, 3rd Edition emphasizes computing fundamentals while recognizing the relevance and validity of object-oriented programming. This book is the result of decades of reasoning about how best to facilitate student learning in the first course of the computer science curriculum, how best to integrate objects and classes into it, and how best to prepare students for the next course.

Selected Features

Traditional Topics. This textbook recognizes the relevance and validity of object-oriented programming while emphasizing traditional computing fundamentals.

Standard C++. Compliant with C++14 and beyond.

Gentle Objects-Early Approach. This third edition maintains the objects-early approach of the first and second editions. Students begin by using existing objects such as string, cin, cout, BankAccount, and Grid for Karel-like (Rich Pattis) programming while honing problem-solving and program-development skills.  

Carefully Chosen Subset of Analysis, Design, and C++. Students concentrate on a solid subset of this feature-rich language, with some trickier topics delayed until later chapters.

Not Tied to a Specific System. There is no bias toward a particular operating system or compiler. This textbook presents standard #includes and namespaces according to the ISO standard. All material applies to any computer system using standard C++. All code has been tested with Microsoft Visual C++ on Windows, and GNU g++ on Unix.

Algorithmic Patterns. The first algorithmic pattern, and perhaps one of the oldest—Input/Process/Output (IPO)—is introduced in Chapter 1 and reused in subsequent chapters. The IPO pattern is especially useful to students with no programming experience and to the lab assistants helping them. Other algorithmic patterns introduced in the appropriate places include Alternative Action and Indeterminate Loop.

Extensively Tested in the Classroom and Lab. This textbook was six years in the making. Students supplied many useful comments and suggestions concerning manuscript clarity, organization, projects, and examples.

What’s New in This Third Edition?

This third edition contains dramatic improvements in programming projects, making them more interesting and challenging. Included are projects developed and class-tested at the University of Arizona.

Chapters on inheritance, object-oriented programming and design, operator overloading, and recursion have been removed to make this book more compatible with CS1 curriculum, while adding a few topics from CS2, such as generic collections with templates.

This edition also incorporates a few appropriate newer additions to C++, such as the long-overdue literal nullptr.

TABLE OF CONTENTS
Chapter 1
     Problem Solving with C++                                              
1.1          Problem Solving
    1.1.1     Analysis (inquiry, examination, study)                                                                             
    1.1.2     Design (model, think, plan, devise, pattern, outline)                                                    
    1.1.3     Algorithmic Patterns                                                                                                             
    1.1.4     An Example of Algorithm Design                                                                                        
    1.1.5     Implementation (fulfillment, operation, usage)                                                           
    1.1.6     A C++ Program                                                                                                                           
    1.1.7     Testing                                                                                                                                        
1.2          Objects, Types, and Variables                                                                                                     
Chapter Summary                                                                                                                                     


Chapter 2     C++ Fundamentals                                                               
2.1          The Pieces of a C++ Program                                                                                                       
    2.1.1     Tokens: The Smallest Pieces of a Program                                                                      
    2.1.2     Special Symbols                                                                                                                       
    2.1.3     Identifiers                                                                                                                                  
    2.1.4     Keywords                                                                                                                                   
    2.1.5     Comments                                                                                                                                   
    2.1.6     C++ Literals                                                                                                                               
2.2          Statements                                                                                                                                             
    2.2.1     Output with cout                                                                                                                    
    2.2.2     Assignment and Type Conversions                                                                                     
    2.2.3     Input with cin                                                                                                                           
2.3          Arithmetic Expressions                                                                                                                  
    2.3.1     int Arithmetic                                                                                                                            
    2.3.2     Mixing Integer and Floating-Point Operands                                                                 
    2.3.3     Constant Objects                                                                                                                    
2.4          Prompt Then Input                                                                                                                            
2.5          Implementation Errors and Warnings                                                                                 
    2.5.1     Errors and Warnings Detected at Compile time                                                            
    2.5.2     Warnings Generated at Compile time
    2.5.3     Linktime Errors                                                                                                                         
    2.5.4     Runtime Errors                                                                                                                          
    2.5.5     Intent Errors                                                                                                                             
    2.5.6     When the Software Doesn’t Match the Specification                                                 
Chapter Summary                                                                                                                                     

Chapter 3     Using Free Functions                                                          
3.1          cmath Functions                                                                                                                               
3.2          Problem Solving with cmath functions                                                                             
    3.2.1     Analysis                                                                                                                                      
    3.2.3     Implementation                                                                                                                      
3.3          Calls to Documented Functions                                                                                              
    3.3.1     Preconditions and Postconditions                                                                                  
    3.3.2     Function Headings                                                                                                                 
    3.3.3     Argument / Parameter Associations                                                                                 
    3.3.4     A few functions for int, char, and bool                                                                        
Chapter Summary                                                                                                                                     

Chapter 4     Implementing Free Functions                                     
4.1          Implementing Your Own Functions                                                                                        
    4.1.1     Test Drivers                                                                                                                               
    4.1.2     Functions with Only a Return Statement                                                                      
4.2          Analysis, Design, and Implementation                                                                                 
    4.2.1     Analysis                                                                                                                                      
    4.2.2     Design                                                                                                                                          
    4.2.3     Implementation                                                                                                                        
    4.2.4     Testing                                                                                                                                        
    4.2.5     Scope of Identifiers                                                                                                                 
    4.2.6     Scope of Function Names                                                                                                      
    4.2.7     Global Identifiers                                                                                                                  
4.3          void Functions & Reference Parameters                                                                             
4.4          const Reference Parameters                                                                                                     
Chapter Summary                                                                                                                                     

Chapter 5     Sending Messages                                                                 
5.1          Modeling the Real World                                                                                                              
    5.1.1     BankAccount Objects                                                                                                            
    5.1.2     Class and Object Diagrams                                                                                                  
5.2          Sending Messages                                                                                                                              
5.3          string Objects                                                                                                                                       
    5.3.1     Accessing Methods                                                                                                                 
    5.3.2     Modifying Methods                                                                                                                 
    5.3.3     Operators defined for string objects                                                                              
5.4          ostream and istream Member Functions                                                                            
    5.4.1     Class Member Function Headings                                                                                     
5.5          Another Nonstandard Class: Grid                                                                                         
    5.5.1     Other Grid Operations                                                                                                            
    5.5.2     Failure to Meet the Preconditions                                                                                     
    5.5.3     Functions with No Arguments Still Need ( )                                                                   
5.6          Why Functions and Classes?                                                                                                      
Chapter Summary                                                                                                                                    

Chapter 6     Class Definitions and Member Functions           
6.1          Defining a Class in a Header File                                                                                              
    6.1.1     Defining class BankAccount                                                                                              
6.2          Implementing Class Member Functions                                                                                
    6.2.1     Implementing Constructors                                                                                                
    6.2.2     Implementing Modifying Member Functions                                                                  
    6.2.3     Implementing Accessing Member Functions                                                                  
6.3          Default Constructors                                                                                                                    
    6.3.1     Function Overloading                                                                                                          
6.4          The State Object Pattern                                                                                                               
    6.4.1     Constructors                                                                                                                            
    6.4.2     Modifiers                                                                                                                                    
    6.4.3     Accessors                                                                                                                                   
    6.4.4     Naming Conventions                                                                                                              
    6.4.5     public: or private:                                                                                                                     
    6.4.6     Separating Interface from Implementation                                                                   
6.5          Object-Oriented Design Guidelines                                                                                          
    6.5.1     Cohesion within a Class                                                                                                        
    6.5.2     Why Are Accessors const and Modifiers Not?                                                               
Chapter Summary                                                                                                                                     

Chapter 7     Selection                                                                                     
7.1          Selective Control                                                                                                                               
    7.1.1     The Guarded Action Pattern                                                                                                
    7.1.2     The if Statement                                                                                                                      
7.2          Relational Operators                                                                                                                   
7.3          The Alternative Action Pattern                                                                                                
    7.3.1     The if...else Statement                                                                                                            
7.4          Blocks with Selection Structures                                                                                           
    7.4.1     The Trouble in Forgetting { and }                                                                                       
7.5          bool Objects                                                                                                                                          
    7.5.1     Boolean Operators                                                                                                                  
    7.5.2     Operator Precedence Rules                                                                                                   
    7.5.3     The Boolean “or” ¦¦ with a grid Object                                                                               
    7.5.4     Short Circuit Boolean Evaluation                                                                                    
7.6          A bool Member Function                                                                                                               
7.7          Multiple Selection                                                                                                                             
    7.7.1     Another Example: Determining Letter Grades                                                                
    7.7.2     Multiple Returns                                                                                                                     
7.8          Testing Multiple Selection                                                                                                           
    7.8.1     Boundary Testing                                                                                                                   
7.9          The assert Function                                                                                                                         
7.10        The switch Statement                                                                                                                      
  7.10.1     char Objects                                                                                                                             
Chapter Summary                                                                                                                                     

Chapter 8     Repetition                                                                                   
8.1          Repetitive Control                                                                                                                            
    8.1.1     Why Is Repetition Needed                                                                                                      
8.2          Algorithmic Pattern: the Determinate Loo
    8.2.1     The for Statement                                                                                                                  
    8.2.2     Other Increment and Assignment Operators                                                                 
    8.2.3     Determinate Loops with Grid Objects                                                                              
8.3          Application of the Determinate Loop Pattern                                                               
    8.3.1     Analysis                                                                                                                                      
    8.3.2     Design                                                                                                                                         
    8.3.3     Implementation                                                                                                                       
    8.3.4     Testing                                                                                                                                        
    8.3.5     What to Do When an Intent Error Is Detected                                                              
8.4          Algorithmic Pattern: The Indeterminate Lop                                                                 
    8.4.1     The Use of while to Implement the Determinate Loop Pattern                                
    8.4.2     Indeterminate Loop Pattern with Grid Objects                                                              
    8.4.3     The Indeterminate Loop Using a Sentinel                                                                         
    8.4.4     Using cin >> as a Loop Test                                                                                                  
    8.4.5     Infinite Loops                                                                                                                          
8.5          The do while Statement                                                                                                                
8.6          Loop Selection and Design                                                                                                            
    8.6.1     Determine Which Type of Loop to Use                                                                                
    8.6.2     Determine the Loop Test
    8.6.3     Write the Statements to Be Repeated                                                                                 
    8.6.4     Bring the Loop One Step Closer to Termination                                                             
    8.6.5     Initialize Objects If Necessary                                                                                             
Chapter Summary                                                                                                                                    

Chapter 9     File Streams                                                                              
9.1          ifstream Objects                                                                                                                                 
    9.1.1     Getting the Path Right                                                                                                          
9.2          The Indeterminate Loop Pattern Applied to Disk Files                                                
    9.2.1     Processing Until End-of-File                                                                                                
    9.2.2     Letting the User Select the File Name                                                                             
9.3          Indeterminate Loop with More Complex Disk File Input                                            
    9.3.1     Mixing Numbers and strings                                                                                                
    9.3.2     The getline Function                                                                                                            
9.4          ofstream Objects                                                                                                                               
Chapter Summary                                                                                                                                     

Chapter 10   Vectors                                                                                         
10.1        The Standard C++ vector Class
  10.1.1     Accessing Individual Elements in a Collection                                                            
  10.1.2     vector Processing with Determinate for Loops                                                           
  10.1.3     Processing the First n Elements in a vector                                                                   
  10.1.4     Out-of-Range Subscript Checking                                                                                      
  10.1.5     vector::capacity, vector::resize, =                                                                                       
10.2        Sequential Search                                                                                                                            
10.3        Messages to Individual Objects in a vector                                                                       
  10.3.1     Initializing a vector of Objects with File Input                                                            
10.4        vector Argument/Parameter Associations   
    10.4.1    const Reference & Parameters   
10.5    Sorting   
10.6    Binary Search   
    Chapter Summary   
    Exercises   
    Programming Tips   
    Programming Projects   
    10A    Reverse   
    10B    Show the Above-Average Ones   
    10C    Sequential Search Function   
    10D    A Collection of BankAccount Objects   
    10E    Palindrome 1   
    10F    Palindrome 2   
    10G    Fibonacci Numbers   
    10H    Salaries  
    10I    Binary Search Function   
    10J    Frequency   
    10K    Eight Vector Processing Functions   
    10L    Class Stats   


Chapter 11    Generic Collections    
11.1    Collection Classes    
    11.1.1    Passing Types as Arguments   
    11.1.2    Templates   
11.2     class Set<Type>   
    11.2.1    The Constructor Set()   
    11.2.2    bool contains(Type const& value) const    
    11.2.3    void insert(Type const& element)    
    11.2.4    bool remove(Type const& removalCandidate)   
11.3    The Iterator Pattern   
    11.3.1    The Iterator Member Functions   
    Chapter Summary   
    Exercises   
    Programming Tips   
    Programming Projects   
    11A    class Stack<Type>   
    11B    PriorityList<Type>   
    11C    PriorityList<Type> throws exceptions   

Chapter 12    Pointers and Memory Management   
12.1    Memory Considerations   
    12.1.1    Pointers   
    12.1.2    Pointers to Objects   
12.2    The Primitive C Array   
    12.2.1    Differences between Primitive Arrays and vectors   
    12.2.2    The Array / Pointer Connection   
    12.2.3    Passing Primitive Array Arguments   
12.3    Allocating Memory with new   
    12.3.1    Allocating memory for arrays at runtime   
12.4     The delete Operator    
12.5     The Singly linked Structure with C structs   
    12.5.1    A List Class using the Singly-linked Data Structure   
    12.5.2    add(std::string)    
    12.5.3    get(int index)   
    12.5.4    remove(string removalCandidate)    
    Chapter Summary   
    Programming Tips   
    Exercises   
    Programming Projects   
    12A    Enhance LinkedList    
    12B     class LinkedStack with a Singly Linked Structure   
    12C    LinkedPriorityList   
    12D    LinkedPriorityList<Type> throws exceptions   

Chapter 13    Vector of Vectors (2D Arrays)   
13.1    vector of vectors    
13.2    class Matrix    
    13.2.1    Scalar Multiplication   
    13.2.2    Matrix Addition   
13.3     Primitive 2D Arrays   
13.4    Arrays with More than Two Subscripts   
    Chapter Summary   
    Exercises   
    Programming Tips   
    Programming Projects   
    13A    Magic Square   
    13B    Game of Life