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.

9780763707989

Programming and Problem Solving With C++

by ; ;
  • ISBN13:

    9780763707989

  • ISBN10:

    0763707988

  • Edition: 4th
  • Format: Paperback
  • Copyright: 2004-04-01
  • Publisher: Jones & Bartlett
  • 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: $121.95

Summary

This text, assumes no prior programming experience and is most appropriate for introductory programming courses using C++. Introduction to Programming Computer Science, Introduction to Computer Science

Table of Contents

Preface v
1 Overview of Programming and Problem Solving
1(44)
1.1 Overview of Programming
2(7)
What is Programming
2(1)
How Do We Write a Program
3(6)
1.2 What Is a Programming Language
9(6)
1.3 What Is a Computer
15(9)
1.4 Ethics and Responsibilities in the Computing Profession
24(3)
Software Piracy
24(1)
Privacy of Data
25(1)
Use of Computer Resources
26(1)
Software Engineering
27(1)
1.5 Problem-Solving Techniques
27(18)
Ask Questions
28(1)
Look for Things That Are Familiar
28(1)
Solve by Analogy
28(1)
Means-Ends Analysis
29(1)
Divide and Conquer
30(1)
The Building-Block Approach
30(1)
Merging Solutions
31(1)
Mental Blocks: The Fear of Starting
32(1)
Algorithmic Problem Solving
33(1)
Problem-Solving Case Study: Leap Year Algorithm
33(45)
Summary
37(1)
Quick Check
38(1)
Answers
39(1)
Exam Preparation Exercises
39(2)
Programming Warm-Up Exercises
41(1)
Case Study Follow-Up
42(3)
2 C++ Syntax and Semantics, and the Program Development Process
45(50)
2.1 The Elements of C++ Programs
46(23)
C++ Program Structure
46(2)
Syntax and Semantics
48(3)
Syntax Templates
51(3)
Naming Program Elements: identifiers
54(1)
Data and Data Types
55(3)
Naming Elements: Declarations
58(5)
Taking Action: Executable Statements
63(5)
Beyond Minimalism: Adding Comments to a Program
68(1)
2.2 Program Construction
69(7)
Blocks (Compound Statements)
71(2)
The C++ Preprocessor
73(2)
An Introduction to Namespaces
75(1)
2.3 More About Output
76(2)
Creating Blank Lines
76(1)
Inserting Blanks Within a Line
77(1)
2.4 Program Entry, Correction, and Execution
78(17)
Entering a Program
78(1)
Compiling and Running a Program
79(2)
Finishing Up
81(1)
Problem-Solving Case Study: Printing a Chessboard
81(41)
Testing and Debugging
86(1)
Summary
87(1)
Quick Check
87(1)
Answers
88(1)
Exam Preparation Exercises
89(2)
Programming Warm-Up Exercises
91(2)
Programming Problems
93(1)
Case Study Follow-Up
94(1)
3 Numeric Types, Expressions, and Output
95(44)
3.1 Overview of C++ Data Types
96(1)
3.2 Numeric Data Types
97(2)
Integral Types
97(1)
Floating-Point Types
98(1)
3.3 Declarations for Numeric Types
99(2)
Named Constant Declarations
99(1)
Variable Declarations
100(1)
3.4 Simple Arithmetic Expressions
101(4)
Arithmetic Operators
101(3)
Increment and Decrement Operators
104(1)
3.5 Compound Arithmetic Expressions
105(6)
Precedence Rules
105(1)
Type Coercion and Type Casting
106(5)
3.6 Function Calls and Library Functions
111(4)
Value-Returning Functions
111(2)
Library Functions
113(1)
Void Functions
114(1)
3.7 Formatting the Output
115(7)
Integers and Strings
115(3)
Floating-Point Numbers
118(4)
3.8 Additional string Operations
122(17)
The length and size Functions
122(2)
The find Function
124(1)
The substr Functions
125(3)
Problem-Solving Case Study: Mortgage Payment Calculator
128(45)
Testing and Debugging
131(1)
Summary
132(1)
Quick Check
133(1)
Answers
133(1)
Exam Preparation Exercises
134(1)
Programming Warm-Up Exercises
135(2)
Programming Problems
137(1)
Case Study Follow-Up
138(1)
4 Program Input and the Software Design Process
139(52)
4.1 Getting Data into Programs
140(10)
Input Streams and the Extraction Operator (>>)
141(3)
The Reading Marker and the Newline Character
144(1)
Reading Character Data with the get Function
145(3)
Skipping Characters with the ignore Function
148(1)
Reading String Data
149(1)
4.2 Interactive Input/Output
150(2)
4.3 Noninteractive Input/Output
152(1)
4.4 File Input and Output
153(7)
Files
153(1)
Using Files
154(3)
An Example Program Using Files
157(2)
Run-Time Input of File Names
159(1)
4.5 Input Failure
160(2)
4.6 Software Design Methodologies
162(1)
4.7 What Are Objects?
163(2)
4.8 Object-Oriented Design
165(1)
4.9 Functional Decomposition
166(2)
Modules
168(1)
Implementing the Design
169(4)
A Perspective on Design
173(1)
Problem-Solving Case Study: Display a Name in Multiple Formats
174(45)
Testing and Debugging
180(1)
Testing and Debugging Hints
181(1)
Summary
182(1)
Quick Check
183(1)
Answers
184(1)
Exam Preparation Exercises
184(2)
Programming Warm-Up Exercises
186(2)
Programming Problems
188(2)
Case Study Follow-Up
190(1)
5 Conditions, Logical Expressions, and Selection Control Structures
191(58)
5.1 Flow of Control
192(2)
Selection
193(1)
5.2 Conditions and Logical Expressions
194(13)
The bool Data Type
194(1)
Logical Expressions
195(9)
Precedence of Operators
204(2)
Relational Operators with Floating-Point Types
206(1)
5.3 The If Statement
207(7)
The if-Then-Else Form
207(3)
Blocks (Compound Statements)
210(2)
The if-Then Form
212(2)
A Common Mistake
214(1)
5.4 Nested If Statements
214(5)
The Dangling else
218(1)
5.5 Testing the State of an I/O Stream
219(30)
Problem-Solving Case Study: BM1 Calculator
221(47)
Testing and Debugging
227(1)
Testing in the Problem-Solving Phase: The Algorithm Walk-Through
227(3)
Testing in the Implementation Phase
230(5)
The Test Plan
235(3)
Testing and Debugging Hints
238(2)
Summary
240(1)
Quick Check
240(1)
Answers
241(1)
Exam Preparation Exercises
241(2)
Programming Warm-Up Exercises
243(2)
Programming Problems
245(3)
Case Study Follow-Up
248(1)
6 Looping
249(56)
6.1 The While Statement
250(2)
6.2 Phases of Loop Execution
252(1)
6.3 Loops Using the While Statement
253(11)
Count-Controlled Loops
253(2)
Event-Controlled Loops
255(6)
Looping Subtasks
261(3)
6.4 How to Design Loops
264(4)
Designing the Flow of Control
265(1)
Designing the Process Within the Loop
266(1)
The Loop Exit
267(1)
6.5 Nested Logic
268(37)
Designing Nested Loops
272(7)
Problem Solving Case Study: Recording Studio Design
279(42)
Testing and Debugging
291(1)
Loop-Testing Strategy
291(1)
Test Plans Involving Loops
291(2)
Testing and Debugging Hints
293(1)
Summary
294(1)
Quick Check
295(1)
Answers
296(1)
Exam Preparation Exercises
296(3)
Programming Warm-Up Exercises
299(2)
Programming Problems
301(2)
Case Study Follow-Up
303(2)
7 Functions
305(56)
7.1 Functional Decomposition with Void Functions
306(6)
When to Use Functions
307(1)
Writing Modules as Void Functions
307(5)
7.2 An Overview of User-Defined Functions
312(3)
Flow of Control in Function Calls
312(1)
Function Parameters
312(3)
7.3 Syntax and Semantics of Void Functions
315(7)
Function Call (Invocation)
315(1)
Function Declarations and Definitions
316(2)
Local Variables
318(2)
The Return Statement
320(1)
Header Files
321(1)
7.4 Parameters
322
Value Parameters
323(1)
Reference Parameters
324(3)
An Analogy
327(1)
Matching Arguments with Parameters
328
7.5 Designing Functions
321(40)
Writing Assertions as Program Comments
333(2)
Documenting the Direction of Data Flow
335(5)
Problem-Solving Case Study: Total Cost of Mortgage
340(39)
Testing and Debugging
346(1)
The assert Library Function
347(2)
Testing and Debugging Hints
349(1)
Summary
350(1)
Quick Check
350(1)
Answers
351(1)
Exam Preparation Exercises
351(2)
Programming Warm-Up Exercises
353(2)
Programming Problems
355(4)
Case Study Follow-Up Answers
359(2)
8 Scope, Lifetime, and More on Functions
361(56)
8.1 Scope of Identifiers
362(10)
Scope Rules
364(4)
Variable Declarations and Definitions
368(1)
Namespaces
369(3)
8.2 Lifetime of a Variable
372(2)
Initializations in Declarations
372(2)
8.3 Interface Design
374(5)
Side Effects
374(3)
Global Constants
377(2)
8.4 Value-Returning Functions
379(38)
Boolean Functions
384(4)
Interface Design and Side Effects
388(1)
When to Use Value-Returning Functions
389(2)
Problem-Solving Case Study: Health Profile
391(42)
Testing and Debugging
402(1)
Stubs and Drivers
402(4)
Testing and Debugging Hints
406(2)
Summary
408(1)
Quick Check
408(1)
Answers
409(1)
Exam Preparation Exercises
409(3)
Programming Warm-Up Exercises
412(2)
Programming Problems
414(2)
Case Study Follow-Up
416(1)
9 Additional Control Structures
417(32)
9.1 The Switch Statement
418(5)
9.2 The Do-While Statement
423(3)
9.3 The For Statement
426(4)
9.4 The Break and Continue Statements
430(3)
9.5 Guidelines for Choosing a Looping Statement
433(17)
Problem-Solving Case Study: The Rich Uncle
434(61)
Testing and Debugging
441(1)
Testing and Debugging Hints
441(1)
Summary
442(1)
Quick Check
442(1)
Answers
442(1)
Exam Preparation Exercises
442(3)
Programming Warm-Up Exercises
445(1)
Programming Problems
445(3)
Case Study Follow-Up
448(1)
10 Simple Data Types: Built-In and User-Defined 449
10.1 Built-In Simple Types
450(6)
Integral Types
452(3)
Floating-Point Types
455(1)
10.2 Additional C++ Operators
456(8)
Assignment Operators and Assignment Expressions
458(1)
Increment and Decrement Operators
459(1)
Bitwise Operators
460(1)
The Cast Operation
460(1)
The sizeof Operator
461(1)
The ?: Operator
461(1)
Operator Precedence
462(2)
10.3 Working with Character Data
464(11)
Character Sets
465(2)
C++ char Constants
467(1)
Programming Techniques
468(7)
10.4 More on Floating-Point Numbers
475(10)
Representation of Floating-Point Numbers
475(3)
Arithmetic with Floating-Point Numbers
478(1)
Implementation of Floating-Point Numbers in the Computer
479(6)
10.5 User-Defined Simple Types
485(10)
The Typedef Statement
486(1)
Enumeration Types
486(7)
Named and Anonymous Data Types
493(1)
User-Written Header Files
494(1)
10.6 More on Type Coercion
495(25)
Type Coercion in Arithmetic and Relational Expressions
496(1)
Type Coercion in Assignments, Argument Passing, and Return of a Function Value
497(2)
Problem-Solving Case Study: Stylistical Analysis of Text
499(57)
Testing and Debugging
509(1)
Floating-Point Data
509(1)
Coping with Input Errors
509(1)
Testing and Debugging Hints
510(1)
Summary
511(1)
Quick Check
512(1)
Answers
513(1)
Exam Preparation Exercises
513(1)
Programming Warm-Up Exercises
514(1)
Programming Problems
515(3)
Case Study Follow-Up
518
11 Structured Types, Data Abstraction, and Classes 19(568)
11.1 Simple Versus Structured Data Types
520(1)
11.2 Records (Structs)
521(10)
Accessing Individual Components
523(2)
Aggregate Operations on Structs
525(1)
More About Struct Declarations
526(3)
Binding Like Items 528 Hierarchical Records
529(2)
11.3 Unions
531(2)
11.4 Data Abstraction
533(2)
11.5 Abstract Data Types
535(3)
11.6 C++ Classes
538(9)
Classes, Class Objects, and Class Members
542(1)
Built-in Operations on Class Objects
543(2)
Class Scope
545(1)
Information Hiding
545(2)
11.7 Specification and Implementation File
547(9)
The Specification File
547(2)
The Implementation File
549(5)
Compiling and Linking a Multifile Program
554(2)
11.8 Guaranteed Initialization with Class Constructors
556(32)
Invoking a Constructor
558(1)
Revised Specification and Implementation Files for Time
559(3)
Guidelines for Using Class Constructors
562(2)
Problem-Solving Case Study: Abstract Data Type Name
564(58)
Testing and Debugging
574(4)
Testing and Debugging Hints
578(1)
Summary
579(1)
Quick Check
579(1)
Answers
580(1)
Exam Preparation Exercises
580(2)
Programming Warm-Up Exercises
582(2)
Programming Problems
584(2)
Case Study Follow-Up
586(1)
12 Arrays 587(74)
12.1 One-Dimensional Arrays
588(17)
Declaring Arrays
590(1)
Accessing Individual Components
591(3)
Out-of-Bounds Array Indexes
594(1)
Initializing Arrays in Declarations
594(1)
(Lack of) Aggregate Array Operations
595(1)
Examples of Declaring and Accessing Arrays
596(5)
Passing Arrays as Arguments
601(3)
Assertions About Arrays
604(1)
Using Typedef with Arrays
604(1)
12.2 Arrays of Records and Class Objects
605(3)
Arrays of Records
605(2)
Arrays of Class Objects
607(1)
12.3 Special Kinds of Array Processing
608(1)
Subarray Processing
608(1)
Indexes with Semantic Content
608(1)
12.4 Two-Dimensional Arrays
609(3)
12.5 Processing Two-Dimensional Arrays
612(6)
Sum the Rows
613(2)
Sum the Columns
615(1)
Initialize the Array
616(1)
Print the Array
617(1)
12.6 Passing Two-Dimensional Arrays as Arguments
618(2)
12.7 Another Way of Defining Two-Dimensional Arrays
620(2)
12.8 Multidimensional Arrays
622(40)
Problem-Solving Case Study: Calculating Exam Statistics
625(11)
Problem-Solving Case Study: Favorite Rock Group
636(60)
Testing and Debugging
645(1)
One-Dimensional Arrays
645(1)
Complex Structures
646(2)
Multidimensional Arrays
648(1)
Testing and Debugging Hints
649(1)
Summary
650(1)
Quick Check
650(1)
Answers
651(1)
Exam Preparation Exercises
652(2)
Programming Warm-Up Exercises
654(2)
Programming Problems
656(3)
Case Study Follow-Up
659(2)
13 Array-Based Lists 661(62)
13.1 The List as an Abstract Data Type
662(7)
13.2 Unsorted Lists
669(12)
Basic Operations
669(2)
Insertion and Deletion
671(2)
Sequential Search
673(3)
Iterators
676(2)
Sorting
678(3)
13.3 Sorted Lists
681(15)
Basic Operations
684(1)
Insertion
684(3)
Sequential Search
687(1)
Binary Search
687(6)
Deletion
693(3)
13.4 Understanding Character Strings
696(28)
Initializing C Strings
699(1)
C String Input and Output
699(3)
C String Library Routines
702(2)
String Class or C Strings?
704(1)
Problem-Solving Case Study: Calculating Exam Statistics Revisited
705(52)
Testing and Debugging
716(1)
Testing and Debugging Hints 716
Summary
717(1)
Quick Check
717(1)
Answers
718(1)
Exam Preparation Exercises
718(1)
Programming Warm-Up Exercises
719(1)
Programming Problems
720(1)
Case Study Follow-Up
721(2)
14 Object-Oriented Software Development 723(58)
14.1 Object-Oriented Programming
724(2)
14.2 Objects
726(5)
14.3 Inheritance
731(11)
Deriving One Class from Another
732(3)
Specification of the ExtTime Class
735(2)
Implementation of the ExtTime Class
737(5)
Avoiding Multiple Inclusion of Header Files
742(1)
14.4 Composition
742(8)
Design of an Entry Class
743(6)
Constructor initializer
749(1)
14.5 Dynamic Binding and Virtual Functions
750(4)
The Slicing Problem
751(2)
Virtual Functions
753(1)
14.6 Object-Oriented Design
754(3)
Step 1: Identify the Objects and Operations
755(1)
Step 2: Determine the Relationships Among Objects
756(1)
Step 3: Design the Driver
756(1)
14.7 Implementing the Design
757(25)
Problem-Solving Case Study: Creating an Appointment Calendar
758(44)
Testing and Debugging
770(1)
Testing and Debugging Hints
771(1)
Summary
772(1)
Quick Check
772(1)
Answers
773(1)
Exam Preparation Exercises
773(3)
Programming Warm-Up Exercises
776(2)
Programming Problems
778(2)
Case Study Follow-Up
780(1)
15 Pointers, Dynamic Data, and Reference Types 781(64)
15.1 Pointers
782(10)
Pointer Variables
782(5)
Pointer Expressions
787(5)
15.2 Dynamic Data
792(6)
15.3 Reference Types
798(4)
15.4 Classes and Dynamic Data
802(44)
Class Destructors
807(1)
Shallow Versus Deep Copying
808(1)
Class Copy-Constructors
809(4)
Problem-Solving Case Study: Creating an Appointment Calendar Continued
813(64)
Testing and Debugging
833(1)
Testing and Debugging Hints
834(2)
Summary
836(1)
Quick Check
836(1)
Answers
837(1)
Exam Preparation Exercises
837(3)
Programming Warm-Up Exercises
840(1)
Programming Problems
841(2)
Case Study Follow-Up
843(2)
16 Linked Structures 845(62)
16.1 Sequential Versus Linked Structures
846(2)
16.2 Array Representation of a Linked List
848(2)
16.3 Dynamic Data Representation of a Linked List
850(27)
Algorithms on Dynamic Linked Lists
856(18)
Pointer Expression
874(1)
Classes and Dynamic Linked Lists
875(2)
16.4 Choice of Data Representation
877(31)
Problem-Solving Case Study: The Appointment Calendar Completed
879(47)
Testing and Debugging
899(1)
Testing and Debugging Hints
899(1)
Summary
899(1)
Quick Check
900(1)
Answers
900(1)
Exam Preparation Exercises
900(2)
Programming Warm-Up Exercises
902(1)
Programming Problems
903(3)
Case Study Follow-Up
906(1)
17 Templates and Exceptions 907(63)
17.1 Template Functions
908(10)
Function Overloading
908(3)
Defining a Function Template
911(1)
Instantiating a Function Template
912(1)
Enhancing the Print Template
913(1)
User-Defined Specifications
914(1)
Organization of Program Code
915(3)
17.2 Template Classes
918(8)
Instantiating a Class Template
920(2)
Organization of Program Code
922(3)
A Caution
925(1)
17.3 Exceptions
926(44)
The throw Statement
927(2)
The try-catch Statement
929(3)
Nonlocal Exception Handlers
932(3)
Re-Throwing an Exception
935(1)
Standard Exceptions
936(3)
Back to the Division-by-Zero Problem
939(1)
Problem-Solving Case Study: Re-Implement SortedList Specification and Enhance Appointment Calendar
940(52)
Testing and Debugging
960(1)
Testing and Debugging Hints
960(1)
Summary
961(1)
Quick Check
962(1)
Answers
963(1)
Exam Preparation Exercises
964(1)
Programming Warm-Up Exercises
965(2)
Programming Problems
967(1)
Case Study Follow-Up
968(2)
18 Recursion
18.1 What is Recursion?
970(4)
18.2 Recursive Algorithms with Simple Variables
974(3)
18.3 Towers of Hanoi
977(5)
18.4 Recursive Algorithms with Structured Variables
982(2)
18.5 Recursion Using Pointer Variables
984(8)
Printing a Dynamic Linked List in Reverse Order
985(2)
Copying a Dynamic Linked List
987(5)
18.6 Recursion or Iteration?
992(21)
Problem-Solving Case Study: Quick sort
993(18)
Testing and Debugging
1001(1)
Testing and Debugging Hints
1001(1)
Summary
1001(1)
Quick Check
1002(1)
Answers
1002(1)
Exam Preparation Exercises
1002(3)
Programming Warm-Up Exercises
1005(2)
Programming Problems
1007(2)
Case Study Follow-Up
1009(2)
Appendix A Reserved Words 1011(1)
Appendix B Operator Precedence 1011(2)
Appendix C A Selection of Standard Library Routines 1013(10)
C.1 The 1-leader File cassert
1013(1)
C.2 The Header File cctype
1013(2)
C.3 The Header File cfloat
1015(1)
C.4 The Header File climits
1016(1)
C.5 The Header File cmath
1016(2)
C.6 The Header File cstddef
1018(1)
C.7 The Header File cstdlib
1018(2)
C.8 The Header File cstring
1020(1)
C.9 The Header File string
1021(1)
C.10 The Header File sstream
1022(1)
Appendix D Using This Book with a Prestandard Version of C++ 1023(5)
D.1 The string Type
1023(1)
D.2 Standard Header Files and Namespaces
1024(2)
D.3 The fixed and showpoint Manipulators
1026(1)
D.4 The bool Type
1026(2)
Appendix E Character Sets 1028(2)
Appendix F Program Style, Formatting, and Documentation 1030(9)
F.1 General Guidelines
1031(1)
F.2 Comments
1031(3)
F.3 Identifiers
1034(1)
F.4 Formatting Lines and Expressions
1034(1)
F.5 Indentation
1035(4)
Glossary 1039(10)
Answers to Selected Exercises 1049(38)
Index 1087

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