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.

9780130384744

C++ How to Program

by ;
  • ISBN13:

    9780130384744

  • ISBN10:

    0130384747

  • Edition: 4th
  • Format: Paperback w/CD
  • Copyright: 2003-01-01
  • Publisher: Pearson
  • 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: $85.00

Summary

With nearly 250,000 sold, Harvey and Paul Deitel'sC++ How to Programis the world's best-selling introduction to C++ programming. Now, this classic has been thoroughly updated! The authors have given this edition a general tune-up of object-oriented programming presentation. The new Fourth Edition has a new code-highlighting style that uses an alternate background color to focus the reader on new code elements in a program. The Deitels' C++ How to Program is the most comprehensive, practical introduction to C++ ever published -- with hundreds of hands-on exercises, roughly 250 complete programs written and documented for easy learning, and exceptional insight into good programming practices, maximizing performance, avoiding errors, debugging, and testing. This new Fourth Edition has an upgraded OOD/UML case to latest UML standard, as well as significant improvements to exception handling and operator overloading chapters. Features enhanced treatment of strings and arrays as objects earlier in the book using standard C++ classes, string and vector. The Fourth Edition retains every key concept and technique ANSI C++ developers need to master: control structures, functions, arrays, pointers and strings, classes and data abstraction, operator overloading, inheritance, virtual functions, polymorphism, I/O, templates, exception handling, file processing, data structures, and more. It also includes a detailed introduction to Standard Template Library (STL) containers, container adapters, algorithms, and iterators. The accompanying CD-ROM includes all the code from the book as well as essential software for learning C++. For anyone who wants to learn C++, improve their existing C++ skills, and master object-oriented development with C++.

Author Biography

Harvey M. Deitel is co-founder of Deitel & Associates, Inc.

Table of Contents

Preface xxxiv
Introduction to Computers and C++ Programming
1(69)
Introduction
2(2)
What is a Computer?
4(1)
Computer Organization
5(1)
Evolution of Operating Systems
6(1)
Personal Computing, Distributed Computing and Client/Server Computing
7(1)
Machine Languages, Assembly Languages, and High-level Languages
7(1)
History of C and C++
8(2)
C++ Standard Library
10(1)
Java
11(1)
Visual Basic, Visual C++ and C#
11(2)
Other High-level Languages
13(1)
Structured Programming
13(1)
The Key Software Trend: Object Technology
14(1)
Basics of a Typical C++ Environment
15(2)
Hardware Trends
17(1)
History of the Internet
18(1)
History of the World Wide Web
19(1)
World Wide Web Consortium (W3C)
20(1)
General Notes About C++ and This Book
20(1)
Introduction to C++ Programming
21(1)
A Simple Program: Printing a Line of Text
21(5)
Another Simple Program: Adding Two Integers
26(4)
Memory Concepts
30(1)
Arithmetic
31(3)
Decision Making: Equality and Relational Operators
34(6)
Thinking About Objects: Introduction to Object Technology and the Unified Modeling Language™
40(4)
Tour of the Book
44(26)
Control Structures
70(99)
Introduction
71(1)
Algorithms
72(1)
Pseudocode
72(1)
Control Structures
73(3)
if Selection Structure
76(1)
if/else Selection Structure
77(4)
while Repetition Structure
81(2)
Formulating Algorithms: Case Study 1 (Counter-Controlled Repetition)
83(3)
Formulating Algorithms with Top-Down, Stepwise Refinement: Case Study 2 (Sentinel-Controlled Repetition)
86(8)
Formulating Algorithms with Top-Down, Stepwise Refinement: Case Study 3 (Nested Control Structures)
94(4)
Assignment Operators
98(1)
Increment and Decrement Operators
99(3)
Essentials of Counter-Controlled Repetition
102(2)
for Repetition Structure
104(5)
Examples Using the for Structure
109(4)
switch Multiple-Selection Structure
113(7)
do/while Repetition Structure
120(2)
break and continue Statements
122(2)
Logical Operators
124(3)
Confusing Equality (==) and Assignment (=) Operators
127(1)
Structured-Programming Summary
128(5)
[Optional Case Study] Thinking About Objects: Identifying a System's Classes from a Problem Statement
133(36)
Functions
169(83)
Introduction
170(1)
Program Components in C++
170(1)
Math Library Functions
171(2)
Functions
173(1)
Function Definitions
174(4)
Function Prototypes
178(2)
Header Files
180(2)
Random Number Generation
182(6)
Example: Game of Chance and Introducing enum
188(4)
Storage Classes
192(3)
Scope Rules
195(3)
Recursion
198(4)
Example Using Recursion: Fibonacci Series
202(4)
Recursion vs. Iteration
206(2)
Functions with Empty Parameter Lists
208(1)
Inline Functions
209(2)
References and Reference Parameters
211(4)
Default Arguments
215(2)
Unary Scope Resolution Operator
217(2)
Function Overloading
219(3)
Function Templates
222(3)
[Optional Case Study] Thinking About Objects: Identifying a Class's Attributes
225(27)
Arrays
252(67)
Introduction
253(1)
Arrays
253(2)
Declaring Arrays
255(1)
Examples Using Arrays
256(16)
Passing Arrays to Functions
272(4)
Sorting Arrays
276(2)
Case Study: Computing Mean, Median and Mode Using Arrays
278(5)
Searching Arrays: Linear Search and Binary Search
283(6)
Multiple-Subscripted Arrays
289(7)
[Optional Case Study) Thinking About Objects: Identifying the Operations of a Class
296(23)
Pointers and Strings
319(85)
Introduction
320(1)
Pointer Variable Declarations and Initialization
320(2)
Pointer Operators
322(3)
Calling Functions by Reference
325(4)
Using const with Pointers
329(7)
Bubble Sort Using Pass-by-Reference
336(5)
Pointer Expressions and Pointer Arithmetic
341(3)
Relationship Between Pointers and Arrays
344(5)
Arrays of Pointers
349(1)
Case Study: Card Shuffling and Dealing Simulation
350(5)
Function Pointers
355(5)
Introduction to Character and String Processing
360(10)
Fundamentals of Characters and Strings
360(2)
String Manipulation Functions of the String-Handling Library
362(8)
[Optional Case Study] Thinking About Objects: Collaborations Among Objects
370(34)
Classes and Data Abstraction
404(64)
Introduction
405(1)
Structure Definitions
406(1)
Accessing Structure Members
407(1)
Implementing User-Defined Type Time with a C-like struct
408(3)
Implementing Abstract Data Type Time with a class
411(7)
Class Scope and Accessing Class Members
418(2)
Separating Interface from Implementation
420(4)
Controlling Access to Members
424(2)
Access Functions and Utility Functions
426(4)
Initializing Class Objects: Constructors
430(1)
Using Default Arguments with Constructors
430(5)
Destructors
435(1)
When Constructors and Destructors Are Called
435(4)
Using Set and Get Functions
439(6)
Subtle Trap: Returning a Reference to a private Data Member
445(3)
Default Memberwise Assignment
448(2)
Software Reusability
450(1)
[Optional Case Study) Thinking About Objects: Starting to Program the Classes for the Elevator Simulator
451(17)
Classes: Part II
468(78)
Introduction
469(1)
const (Constant) Objects and const Member Functions
469(9)
Composition: Objects as Members of Classes
478(7)
friend Functions and friend Classes
485(4)
Using the this Pointer
489(6)
Dynamic Memory Management with Operators new and delete
495(2)
static Class Members
497(5)
Data Abstraction and Information Hiding
502(3)
Example: Array Abstract Data Type
504(1)
Example: String Abstract Data Type
504(1)
Example: Queue Abstract Data Type
505(1)
Container Classes and Iterators
505(1)
Proxy Classes
506(3)
[Optional Case Study] Thinking About Objects: Programming the Classes for the Elevator Simulator
509(37)
Operator Overloading; String and Array Objects
546(63)
Introduction
547(1)
Fundamentals of Operator Overloading
548(1)
Restrictions on Operator Overloading
549(1)
Operator Functions as Class Members vs. as friend Functions
550(2)
Overloading Stream-Insertion and Stream-Extraction Operators
552(3)
Overloading Unary Operators
555(1)
Overloading Binary Operators
555(1)
Case Study: Array Class
556(12)
Converting between Types
568(1)
Case Study: String Class
569(12)
Overloading ++ and --
581(1)
Case Study: A Date Class
582(6)
Standard Library Classes string and vector
588(21)
Object-Oriented Programming: Inheritance
609(53)
Introduction
610(1)
Base Classes and Derived Classes
611(3)
protected Members
614(1)
Relationship between Base Classes and Derived Classes
614(23)
Case Study: Three-Level Inheritance Hierarchy
637(5)
Constructors and Destructors in Derived Classes
642(6)
``Uses A'' and ``Knows A'' Relationships
648(1)
public, protected and private Inheritance
648(1)
Software Engineering with Inheritance
649(1)
[Optional Case Study] Thinking About Objects: Incorporating Inheritance into the Elevator Simulation
650(12)
Object-Oriented Programming: Polymorphism
662(56)
Introduction
663(1)
Relationships Among Objects in an Inheritance Hierarchy
664(15)
Invoking Base-Class Functions from Derived-Class Objects
665(5)
Aiming Derived-Class Pointers at Base-Class Objects
670(2)
Derived-Class Member-Function Calls via Base-Class Pointers
672(1)
Virtual Functions
673(6)
Polymorphism Examples
679(1)
Type Fields and switch Structures
680(1)
Abstract Classes
680(2)
Case Study: Inheriting Interface and Implementation
682(13)
Polymorphism, Virtual Functions and Dynamic Binding ``Under the Hood''
695(4)
Virtual Destructors
699(1)
Case Study: Payroll System Using Polymorphism and Run-Time Type Information with dynamic_cast and typeid
699(19)
Templates
718(19)
Introduction
719(1)
Function Templates
720(3)
Overloading Function Templates
723(1)
Class Templates
723(7)
Class Templates and Nontype Parameters
730(1)
Templates and Inheritance
731(1)
Templates and Friends
731(1)
Templates and static Members
732(5)
C++ Stream Input/Output
737(42)
Introduction
739(1)
Streams
739(4)
Classic Streams vs. Standard Streams
740(1)
iostreasn Library Header Files
740(1)
Stream Input/Output Classes and Objects
741(2)
Stream Output
743(1)
Output of char * Variables
743(1)
Character Output using Member Function put
744(1)
Stream Input
744(4)
get and getline Member Functions
745(3)
istream Member Functions peek, putbaak and ignore
748(1)
Type-Safe I/O
748(1)
Unformatted I/O using read, write and gcount
748(1)
Introduction to Stream Manipulators
749(6)
Integral Stream Base: dac, oct, hex and setbase
750(1)
Floating-Point Precision (precision, setprecision)
751(1)
Field Width (width, setw)
752(2)
Programmer-Defined Manipulators
754(1)
Stream Format States and Stream Manipulators
755(11)
Trailing Zeros and Decimal Points (showpoint)
756(1)
Justification (left, right and internal)
757(2)
Padding (fill, setfill)
759(1)
Integral Stream Base (dac, oct, hex, showbase)
760(1)
Floating-Point Numbers; Scientific and Fixed Notation(scientific, fixed)
761(1)
Uppercase/Lowercase Control (uppercase)
762(1)
Specifying Boolean Format (boolalpha)
763(1)
Setting and Resetting the Format State via Member-Function flags
764(2)
Stream Error States
766(2)
Tying an Output Stream to an Input Stream
768(11)
Exception Handling
779(29)
Introduction
780(1)
Exception-Handling Overview
781(2)
Other Error-Handling Techniques
783(1)
Simple Exception-Handling Example: Divide by Zero
784(4)
Rethrowing an Exception
788(1)
Exception Specifications
789(1)
Processing Unexpected Exceptions
790(1)
Stack Unwinding
790(2)
Constructors, Destructors and Exception Handling
792(1)
Exceptions and Inheritance
793(1)
Processing new Failures
793(4)
Class auto_ptr and Dynamic Memory Allocation
797(3)
Standard Library Exception Hierarchy
800(8)
File Processing
808(42)
Introduction
809(1)
The Data Hierarchy
809(2)
Files and Streams
811(1)
Creating a Sequential-Access File
812(4)
Reading Data from a Sequential-Access File
816(7)
Updating Sequential-Access Files
823(1)
Random-Access Files
824(1)
Creating a Random-Access File
824(5)
Writing Data Randomly to a Random-Access File
829(2)
Reading Data Sequentially from a Random-Access File
831(3)
Example: A Transaction-Processing Program
834(7)
Input/Output of Objects
841(9)
Class string and String Stream Processing
850(30)
Introduction
851(1)
string Assignment and Concatenation
852(3)
Comparing strings
855(2)
Substrings
857(1)
Swapping strings
858(1)
string Characteristics
859(3)
Finding Strings and Characters in a string
862(2)
Replacing Characters in a string
864(2)
Inserting Characters into a string
866(1)
Conversion to C-Style char * Strings
867(2)
Iterators
869(1)
String Stream Processing
870(10)
Web Programming with CGI
880(62)
Introduction
881(1)
HTTP Request Types
882(1)
Multi-Tier Architecture
882(1)
Accessing Web Servers
883(1)
Apache HTTP Server
884(1)
Requesting XHTML Documents
885(1)
Introduction to CGI
885(1)
Simple HTTP Transaction
886(2)
Simple CGI Script
888(7)
Sending Input to a CGI Script
895(2)
Using XHTML Forms to Send Input
897(8)
Other Headers
905(1)
Case Study: An Interactive Web Page
905(4)
Cookies
909(6)
Server-Side Files
915(6)
Case Study: Shopping Cart
921(15)
Internet and Web Resources
936(6)
Data Structures
942(58)
Introduction
943(1)
Self-Referential Classes
944(1)
Dynamic Memory Allocation and Data Structures
945(1)
Linked Lists
945(15)
Stacks
960(5)
Queues
965(4)
Trees
969(31)
Bits, Characters, Strings and Structures
1000(53)
Introduction
1001(1)
Structure Definitions
1001(2)
Initializing Structures
1003(1)
Using Structures with Functions
1004(1)
typedef
1004(1)
Example: High-Performance Card-Shuffling and Dealing Simulation
1005(2)
Bitwise Operators
1007(10)
Bit Fields
1017(3)
Character-Handling Library
1020(6)
String-Conversion Functions
1026(5)
Search Functions of the String-Handling Library
1031(5)
Memory Functions of the String-Handling Library
1036(17)
Preprocessor
1053(12)
Introduction
1054(1)
The #include Preprocessor Directive
1054(1)
The #define Preprocessor Directive: Symbolic Constants
1055(1)
The #define Preprocessor Directive: Macros
1056(1)
Conditional Compilation
1057(1)
The #error and #pragma Preprocessor Directives
1058(1)
The # and ## Operators
1059(1)
Line Numbers
1059(1)
Predefined Symbolic Constants
1060(1)
Assertions
1060(5)
C Legacy Code Topics
1065(25)
Introduction
1066(1)
Redirecting Input/Output on UNIX and DOS Systems
1066(1)
Variable-Length Argument Lists
1067(3)
Using Command-Line Arguments
1070(1)
Notes on Compiling Multiple-Source-File Programs
1071(2)
Program Termination with exit and atexit
1073(2)
The volatile Type Qualifier
1075(1)
Suffixes for Integer and Floating-Point Constants
1075(1)
Signal Handling
1075(3)
Dynamic Memory Allocation with calloc and realloc
1078(1)
The Unconditional Branch: goto
1079(1)
Unions
1080(4)
Linkage Specifications
1084(6)
Standard Template Library (STL)
1090(93)
Introduction to the Standard Template Library (STL)
1092(13)
Introduction to Containers
1094(4)
Introduction to Iterators
1098(5)
Introduction to Algorithms
1103(2)
Sequence Containers
1105(14)
vector Sequence Container
1105(8)
list Sequence Container
1113(4)
deque Sequence Container
1117(2)
Associative Containers
1119(9)
multiset Associative Container
1119(3)
set Associative Container
1122(2)
multimap Associative Container
1124(2)
map Associative Container
1126(2)
Container Adapters
1128(5)
stack Adapter
1128(2)
queue Adapter
1130(2)
priority_queue Adapter
1132(1)
Algorithms
1133(35)
fill, fill_n_generate and generate_n
1134(2)
equal, mismatch and lexicographical_compare
1136(2)
remove, remove_if, remove_copy and remove_copy_if
1138(3)
replace, replace_if, replace_copy and replace_copy_if
1141(3)
Mathematical Algorithms
1144(4)
Basic Searching and Sorting Algorithms
1148(2)
swap, iter_swap and swap_ranges
1150(2)
copy_backward, merge, unique and reverse
1152(2)
iuplace_merge, unique_copy and reverse_copy
1154(2)
Set Operations
1156(4)
lower_bound, upper_bound and equal_range
1160(2)
Heapsort
1162(3)
min and max
1165(1)
Algorithms Not Covered in This Chapter
1166(2)
Class bitset
1168(4)
Function Objects
1172(3)
STL Internet and Web Resources
1175(8)
Other Topics
1183(31)
Introduction
1184(1)
const_cast Operator
1184(1)
reinterpret_cast Operator
1185(1)
namespaces
1186(4)
Operator Keywords
1190(2)
explicit Constructors
1192(5)
mutable Class Members
1197(2)
Pointers to Class Members (. * and ->*)
1199(2)
Multiple Inheritance
1201(4)
Multiple Inheritance and virtual Base Classes
1205(5)
Closing Remarks
1210(4)
A Operator Precedence Chart 1214(2)
B ASCII Character Set 1216(1)
C Number Systems 1217(13)
Introduction
1218(3)
Abbreviating Binary Numbers as Octal Numbers and Hexadecimal Numbers
1221(1)
Converting Octal Numbers and Hexadecimal Numbers to Binary Numbers
1222(1)
Converting from Binary, Octal or Hexadecimal to Decimal
1222(1)
Converting from Decimal to Binary, Octal or Hexadecimal
1223(2)
Negative Binary Numbers: Two's Complement Notation
1225(5)
D C++ Internet and Web Resources 1230(6)
Resources
1230(2)
Tutorials
1232(1)
FAQs
1233(1)
Visual C++
1233(1)
Newsgroups
1233(1)
Compilers and Development Tools
1234(1)
Standard Template Library
1234(2)
E Introduction to XHTML 1236(38)
Introduction
1237(1)
Editing XHTML
1237(1)
First XHTML Example
1238(2)
Headers
1240(2)
Linking
1242(3)
Images
1245(4)
Special Characters and More Line Breaks
1249(2)
Unordered Lists
1251(1)
Nested and Ordered Lists
1251(1)
Basic XHTML Tables
1252(5)
Intermediate XHTML Tables and Formatting
1257(2)
Basic XHTML Forms
1259(3)
More Complex XHTML Forms
1262(7)
Internet and World Wide Web Resources
1269(5)
F XHTML Special Characters 1274(1)
Bibliography 1275(6)
Index 1281

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