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.

9780619160449

C++ Programming

by
  • ISBN13:

    9780619160449

  • ISBN10:

    0619160446

  • Format: Paperback
  • Copyright: 2004-03-23
  • Publisher: Cengage Learning
  • 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: $160.95

Summary

Written exclusively for the student as opposed to the IT professional, this text contains numerous clear and complete explanations and examples. Using problem-solving throughout, this book offers comprehensive coverage of introductory C++ programming topics and then moves the students confidentally into more advanced concepts. Written for the modern programmer, this innovative text focuses on the nature and obvious advantages of C++ as a language. Featuring problem solving throughout the text, examples are relevant to C++ and match and highlight the specific qualities of C++ rather than basic, generic programming examples. This book will provide excellent, comprehensive instruction and theory regarding this language.

Table of Contents

Preface xxxi
An Overview of Computers and Programming Languages
1(22)
Introduction
2(1)
A Brief Overview of the History of Computers
2(1)
Elements of a Computer System
3(3)
Hardware
3(3)
Software
6(1)
The Language of a Computer
6(1)
The Evolution of Programming Languages
7(2)
Processing a High-Level Language Program
9(1)
Programming with the Problem Analysis--Coding--Execution Cycle
10(6)
Programming Methodologies
16(2)
Structured Programming
16(1)
Object-Oriented Programming
16(2)
ANSI/ISO Standard C++
18(1)
Quick Review
18(2)
Exercises
20(3)
Basic Elements of C++
23(72)
The Basics of a C++ Program
24(4)
Data Types
28(6)
Simple Data Types
28(3)
Floating-Point Data Types
31(2)
string Type
33(1)
Arithmetic Operators and Operator Precedence
34(4)
Order of Precedence
37(1)
Expressions
38(4)
Mixed Expressions
39(1)
Type Conversion (Casting)
40(2)
Input
42(13)
Allocating Memory with Constants and Variables
42(2)
Putting Data into Variables
44(11)
Increment and Decrement Operators
55(2)
Output
57(7)
Preprocessor Directives
64(2)
Using cin and cout in a Program and namespace
65(1)
Using the string Data Type in a Program
66(1)
Creating a C++ Program
66(4)
Program Style and Form
70(4)
Syntax
71(1)
Use of Blanks
71(1)
Use of Semicolons, Brackets, and Commas
71(1)
Semantics
71(1)
Form and Style
72(1)
Documentation
73(1)
More on Assignment Statements
74(2)
Programming Example: Convert Length
76(3)
Programming Example: Make Change
79(3)
Quick Review
82(2)
Exercises
84(8)
Programming Exercises
92(3)
Input/Output
95(50)
I/O Streams and Standard I/O Devices
96(6)
cin and the Extraction Operator >>
97(5)
Using Predefined Functions in a Program
102(7)
cin and the get Function
103(1)
cin and the ignore Function
104(2)
putback and peek Functions
106(2)
Dot Notation Between I/O Stream Variables and I/O Functions: A Precaution
108(1)
Input Failure
109(4)
clear Function
111(2)
Output and Formatting Output
113(7)
setprecision Manipulator
113(1)
fixed Manipulator
114(1)
showpoint Manipulator
114(3)
setw
117(2)
flush Manipulator
119(1)
Additional Output Formatting Tools
120(4)
setfill Manipulator
120(2)
left and right Manipulators
122(2)
Input/Output and the string Type
124(1)
File Input/Output
125(4)
Programming Example: Movie Ticket Sale and Donation to Charity
129(6)
Programming Example: Student Grade
135(3)
Quick Review
138(1)
Exercises
139(3)
Programming Exercises
142(3)
Control Structures I (Selection)
145(58)
Control Structures
146(1)
Relational Operators
147(5)
Relational Operators and Simple Data Types
149(1)
Relational Operators and the string Type
150(2)
Logical (Boolean) Operators and Logical Expressions
152(9)
Order of Precedence
154(4)
Short-Circuit Evaluation
158(1)
int Data Type and Logical (Boolean) Expressions
159(1)
bool Data Type and Logical (Boolean) Expressions
160(1)
Selection: if and if...else
161(19)
One-Way Selection
161(3)
Two-Way Selection
164(4)
Compound (Block of) Statements
168(1)
Multiple Selections: Nested if
168(4)
Comparing if...else Statements with a Series of if Statements
172(1)
Using Pseudocode to Develop, Test, and Debug a Program
172(3)
Input Failure and the if Statement
175(3)
Confusion Between the Equality Operator (==) and the Assignment Operator (=)
178(1)
Conditional Operator (?:)
179(1)
switch Structures
180(6)
Terminating a Program with the assert Function
186(3)
Programming Example: Cable Company Billing
189(5)
Quick Review
194(1)
Exercises
195(5)
Programming Exercises
200(3)
Control Structures II (Repetition)
203(66)
Why Is Repetition Needed?
204(1)
while Looping (Repetition) Structure
205(13)
Case 1: Counter-Controlled while Loops
208(2)
Case 2: Sentinel-Controlled while Loops
210(5)
Case 3: Flag-Controlled while Loops
215(1)
Case 4: EOF-Controlled while Loops
216(1)
eof Function
217(1)
Programming Example: Checking Account Balance
218(9)
Programming Example: Fibonacci Number
227(4)
for Looping (Repetition) Structure
231(6)
Programming Example: Classify Numbers
237(4)
do . . . while Looping (Repetition) Structure
241(3)
Break and Continue Statements
244(2)
Nested Control Structures
246(9)
Quick Review
255(1)
Exercises
256(10)
Programming Exercises
266(3)
User-Defined Functions I
269(36)
Predefined Functions
270(3)
User-Defined Functions
273(1)
Value-Returning Functions
273(14)
return Statement
277(3)
Function Prototype
280(6)
Flow of Execution
286(1)
Programming Example: Largest Number
287(2)
Programming Example: Cable Company
289(5)
Quick Review
294(2)
Exercises
296(4)
Programming Exercises
300(5)
User-Defined Functions II
305(68)
Void Functions
306(7)
Void Functions Without Parameters
306(3)
Void Functions with Parameters
309(4)
Value Parameters
313(2)
Reference Variables as Parameters
315(5)
Value and Reference Parameters and Memory Allocation
320(14)
Reference Parameters and Value-Returning Functions
334(1)
Scope of an Identifier
334(4)
Side Effects of Global Variables
338(1)
Static and Automatic Variables
338(2)
Function Overloading: An Introduction
340(1)
Functions with Default Parameters
341(3)
Programming Example: Classify Numbers
344(5)
Programming Example: Data Comparison
349(11)
Quick Review
360(2)
Exercises
362(6)
Programming Exercises
368(5)
User-Defined Simple Data Types, Namespaces, and the string Type
373(50)
Enumeration Type
374(9)
Declaring Variables
376(1)
Assignment
376(1)
Operations on Enumeration Types
377(1)
Enumeration Types and Loops
378(1)
Input/Output of Enumeration Types
378(2)
Functions and Enumeration Types
380(1)
Declaring Variables When Defining the Enumeration Type
381(1)
Anonymous Data Types
381(1)
typedef Statement
382(1)
Programming Example: The Game of Rock, Paper, and Scissors
383(11)
Namespaces
394(5)
string Type
399(11)
Additional string Operations
402(8)
Programming Example: Pig Latin Strings
410(6)
Quick Review
416(2)
Exercises
418(3)
Programming Exercises
421(2)
Arrays and Strings
423(74)
Arrays
425(17)
Accessing Array Components
426(3)
Processing One-Dimensional Arrays
429(4)
Array Index Out of Bounds
433(1)
Array Initialization During Declaration
434(1)
Some Restrictions on Array Processing
435(1)
Arrays as Parameters to Functions
435(6)
Integral Data Type and Array Indices
441(1)
c-strings (Character Arrays)
442(7)
String Comparison
444(2)
Reading and Writing Strings
446(1)
String Input
446(1)
String Output
447(1)
Specifying Input/Output Files at Execution Time
448(1)
Parallel Arrays
449(1)
Two- and Multidimensional Arrays
450(18)
Accessing Array Components
452(1)
Two-Dimensional Array Initialization During Declaration
453(1)
Two-Dimensional Arrays and Enumeration Types
454(2)
Processing Two-Dimensional Arrays
456(6)
Passing Two-Dimensional Arrays as Parameters to Functions
462(3)
Arrays of Strings
465(2)
Another Way to Declare a Two-Dimensional Array
467(1)
Multidimensional Arrays
468(2)
Programming Example: Code Detection
470(7)
Programming Example: Text Processing
477(6)
Quick Review
483(2)
Exercises
485(5)
Programming Exercises
490(7)
Records (structs)
497(42)
Records (structs)
498(17)
Accessing struct Members
500(2)
Assignment
502(2)
Comparison (Relational Operators)
504(1)
Input/Output
504(1)
struct Variables and Functions
505(1)
Arrays versus structs
506(1)
Arrays in structs
506(3)
structs in Arrays
509(2)
structs within a struct
511(4)
Programming Example: Sales Data Analysis
515(17)
Quick Review
532(1)
Exercises
533(2)
Programming Exercises
535(4)
Classes and Data Abstraction
539(78)
Classes
540(33)
Unified Modeling Language Diagrams
543(3)
Built-In Operations on Classes
546(1)
Class Scope
547(1)
Functions and Classes
548(1)
Implementation of Member Functions
549(5)
Accessor and Mutator Functions
554(7)
Order of public and private Members of a Class
561(1)
Constructors
562(2)
Invoking a Constructor
564(6)
Classes and Constructors: A Precaution
570(1)
Arrays of Class Objects (Variables) and Constructors
571(2)
Destructors
573(1)
Data Abstraction, Classes, and Abstract Data Types
574(2)
A struct versus a class
576(1)
Information Hiding
577(4)
Executable Code
581(4)
Static Members of a Class
585(6)
Programming Example: Candy Machine
591(15)
Quick Review
606(2)
Exercises
608(5)
Programming Exercises
613(4)
Inheritance and Composition
617(68)
Inheritance
618(26)
Redefining (Overriding) Member Functions of the Base Class
621(7)
Constructors of Derived and Base Classes
628(8)
Header File of a Derived Class
636(1)
Multiple Inclusions of a Header File
637(1)
C++ Stream Classes
638(1)
Protected Members of a Class
639(1)
Inheritance as public, protected, or private
640(4)
Composition
644(5)
Object-Oriented Design (OOD) and Object-Oriented Programming (OOP)
649(3)
Identifying Classes, Objects, and Operations
651(1)
Programming Example: Grade Report
652(22)
Quick Review
674(1)
Exercises
675(6)
Programming Exercises
681(4)
Pointers, Classes, Lists, and Virtual Functions
685(74)
Pointer Data Type and Pointer Variables
686(2)
Declaring Pointer Variables
686(2)
Address of Operator (&)
688(1)
Dereferencing Operator (*)
688(9)
Classes, Structs, and Pointer Variables
697(3)
Initializing Pointer Variables
700(1)
Dynamic Variables
700(4)
Operator new
701(1)
Operator delete
702(2)
Operations on Pointer Variables
704(2)
Dynamic Arrays
706(4)
Functions and Pointers
709(1)
Shallow versus Deep Copy and Pointers
710(3)
Classes and Pointers: Some Peculiarities
713(12)
Destructor
714(1)
Assignment Operator
715(2)
Copy Constructor
717(8)
Array-Based Lists
725(14)
Copy Constructor
734(1)
Search
734(2)
Insert
736(1)
Remove
736(3)
Inheritance, Pointers, and Virtual Functions
739(7)
Classes and Virtual Destructors
745(1)
Address of Operator and Classes
746(3)
Quick Review
749(2)
Exercises
751(7)
Programming Exercises
758(1)
Overloading and Templates
759(92)
Why Operator Overloading Is Needed
760(1)
Operator Overloading
761(41)
Syntax for Operator Functions
761(1)
Overloading an Operator: Some Restrictions
762(1)
Pointer this
762(6)
Friend Functions of Classes
768(3)
Operator Functions as Member Functions and Nonmember Functions
771(3)
Overloading Binary Operators
774(6)
Overloading the Stream Insertion (<<) and Extraction (>>) Operators
780(5)
Overloading the Assignment Operator (=)
785(8)
Overloading Unary Operators
793(1)
Overloading the Increment (++) and Decrement (--) Operators
794(7)
Operator Overloading: Member Versus Nonmember
801(1)
Classes and Pointer Data Members (Revisited)
801(1)
Operator Overloading: One Final Word
801(1)
Programming Example: clockType
802(7)
Programming Example: Complex Numbers
809(6)
Overloading the Array Index (Subscript) Operator ([ ])
815(1)
Programming Example: newString
816(7)
Function Overloading
823(1)
Templates
823(13)
Function Templates
824(2)
Class Templates
826(3)
Array-Based Lists (Revisited)
829(7)
Quick Review
836(3)
Exercises
839(5)
Programming Exercises
844(7)
Exception Handling
851(40)
Handling Exceptions within a Program
852(16)
C++ Mechanisms of Exception Handling
856(1)
try/catch Block
856(8)
Using C++ Exception Classes
864(4)
Creating Your Own Exception Classes
868(10)
Rethrowing and Throwing an Exception
874(4)
Exception Handling Techniques
878(2)
Terminate the Program
878(1)
Fix the Error and Continue
879(1)
Log the Error and Continue
880(1)
Stack Unwinding
880(4)
Quick Review
884(2)
Exercises
886(3)
Programming Exercises
889(2)
Recursion
891(34)
Recursive Definitions
892(4)
Direct and Indirect Recursion
895(1)
Infinite Recursion
895(1)
Problem Solving Using Recursion
896(12)
Tower of Hanoi: Analysis
907(1)
Recursion or Iteration?
908(1)
Programming Example: Converting a Number from Binary to Decimal
909(4)
Programming Example: Converting a Number from Decimal to Binary
913(3)
Quick Review
916(1)
Exercises
917(3)
Programming Exercises
920(5)
Linked Lists
925(92)
Linked Lists
926(16)
Linked Lists: Some Properties
928(3)
Item Insertion and Deletion
931(6)
Building a Linked List
937(5)
Linked List as an ADT
942(17)
Length of a List
948(1)
Retrieve the Data of the First Node
948(1)
Retrieve the Data of the Last Node
948(1)
Search the List
948(2)
Insert the First Node
950(1)
Insert the Last Node
950(6)
Copy the List
956(2)
Destructor
958(1)
Copy Constructor
958(1)
Overloading the Assignment Operator
958(1)
Ordered Linked Lists
959(15)
Doubly Linked Lists
974(12)
Default Constructor
977(1)
isEmptyList
977(1)
Destroy the List
978(1)
Initialize the List
978(1)
Length of the List
978(1)
Print the List
978(1)
Reverse Print the List
979(1)
Search the List
979(1)
First and Last Elements
980(6)
Programming Example: Video Store
986(22)
Quick Review
1008(1)
Exercises
1008(4)
Programming Exercises
1012(5)
Stacks and Queues
1017(116)
Stacks
1018(5)
Stack Operations
1022(1)
Implementation of Stacks as Arrays
1023(18)
Copy Stack
1034(1)
Constructor and Destructor
1034(1)
Copy Constructor
1035(1)
Overloading the Assignment Operator (=)
1035(1)
Stack Header File
1035(6)
Programming Example: Highest GPA
1041(4)
Linked Implementation of Stacks
1045(17)
Return the Top Element
1054(2)
Copy Stack
1056(4)
Stack as Derived from the class linkedListType
1060(2)
Application of Stacks: Postfix Expressions Calculator
1062(11)
Removing Recursion: Nonrecursive Algorithm to Print a Linked List Backward
1073(7)
Queues
1080(21)
Queue Operations
1081(1)
Implementation of Queues as Arrays
1082(11)
Linked Implementation of Queues
1093(5)
Queue Derived from the class linkedListType
1098(3)
Application of Queues: Simulation
1101(23)
Designing a Queuing System
1102(2)
Customer
1104(2)
Server
1106(4)
Server List
1110(4)
Waiting Customers Queue
1114(2)
Main Program
1116(8)
Quick Review
1124(1)
Exercises
1124(5)
Programming Exercises
1129(4)
Searching and Sorting Algorithms
1133(92)
Search Algorithms
1134(14)
Sequential Search
1137(2)
Ordered Lists
1139(1)
Binary Search
1140(6)
Insertion into an Ordered List
1146(2)
Asymptotic Notations
1148(3)
Lower Bound on Comparison-Based Search Algorithms
1151(1)
Sorting Algorithms
1151(10)
Bubble Sort
1152(3)
Selection Sort: Array-Based Lists
1155(5)
Analysis: Selection Sort
1160(1)
Insertion Sort: Array-Based Lists
1161(6)
Insertion Sort: Linked List-Based Lists
1167(7)
Analysis: Insertion Sort
1172(1)
Lower Bound on Comparison-Based Sort Algorithms
1173(1)
Quick Sort: Array-Based Lists
1174(10)
Analysis: Quick Sort
1183(1)
Merge Sort: Linked List-Based Lists
1184(10)
Divide
1186(2)
Merge
1188(5)
Analysis: Merge Sort
1193(1)
Programming Example: Election Results
1194(24)
Quick Review
1218(1)
Exercises
1219(2)
Programming Exercises
1221(4)
Binary Trees
1225(64)
Binary Trees
1226(21)
Copy Tree
1233(1)
Binary Tree Traversal
1234(5)
Implementing Binary Trees
1239(8)
Binary Search Trees
1247(16)
Binary Search Tree: Analysis
1262(1)
Nonrecursive Binary Tree Traversal Algorithms
1263(4)
Nonrecursive Inorder Traversal
1263(2)
Nonrecursive Preorder Traversal
1265(1)
Nonrecursive Postorder Traversal
1266(1)
Binary Tree Traversal and Functions as Parameters
1267(4)
Programming Example: Video Store (Revisited)
1271(12)
Quick Review
1283(1)
Exercises
1284(3)
Programming Exercises
1287(2)
Graphs
1289(42)
Introduction
1290(4)
Graph Definitions and Notations
1291(3)
Graph Representation
1294(3)
Adjacency Matrix
1294(1)
Adjacency Lists
1295(2)
Operations on Graphs
1297(2)
Graphs as ADTs
1299(3)
Graph Traversals
1302(6)
Depth First Traversal
1303(2)
Breadth First Traversal
1305(3)
Shortest Path Algorithm
1308(7)
Shortest Path
1309(6)
Minimal Spanning Tree
1315(9)
Quick Review
1324(2)
Exercises
1326(2)
Programming Exercises
1328(3)
Standard Template Library (STL)
1331(112)
Components of the STL
1332(25)
Container Types
1333(1)
Sequence Containers
1333(1)
Sequence Container: vector
1333(8)
Member Functions Common to all Containers
1341(2)
Member Functions Common to Sequence Containers
1343(1)
The copy Algorithm
1343(4)
Sequence Container: deque
1347(4)
Sequence Container: list
1351(6)
Iterators
1357(6)
Types of Iterators
1357(5)
Stream Iterators
1362(1)
Associative Containers
1363(6)
Associative Containers: set and multiset
1364(1)
Declaring set or multiset Associative Containers
1364(2)
Item Insertion and Deletion from set/multiset
1366(3)
Container Adapters
1369(4)
Stack
1369(2)
Queue
1371(2)
Containers, Associated Header Files, and Iterator Support
1373(1)
Algorithms
1374(62)
STL Algorithm Classification
1374(3)
Function Objects
1377(6)
Insert Iterator
1383(2)
STL Algorithms
1385(1)
The Functions fill and fill_n
1385(1)
The Functions generate and generate_n
1386(2)
The Functions find, find_if, find_end, and find_first_of
1388(6)
The Functions remove, remove_if, remove_copy, and remove_copy_if
1394(3)
The Functions replace, replace_if, replace_copy, and replace_copy_if
1397(4)
The Functions swap, iter_swap, and swap_ranges
1401(3)
The Functions search, search_n, sort, and binary_search
1404(4)
The Functions adjacent_find, merge, and inplace_merge
1408(4)
The Functions reverse, reverse_copy, rotate, and rotate_copy
1412(4)
The Functions count, count_if, max_element, min_element, and random_shuffle
1416(4)
The Functions for_each and transform
1420(2)
The Functions includes, set_intersection, set_union, set_difference, and set_symmetric_difference
1422(9)
The Functions accumulate, adjacent_difference, inner_product, and partial_sum
1431(5)
Quick Review
1436(4)
Exercises
1440(2)
Programming Exercises
1442(1)
Appendix A Reserved Words 1443(2)
Appendix B Operator Precedence 1445

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