logo资料库

C++ How to Program(9th) 无水印pdf.pdf

第1页 / 共1065页
第2页 / 共1065页
第3页 / 共1065页
第4页 / 共1065页
第5页 / 共1065页
第6页 / 共1065页
第7页 / 共1065页
第8页 / 共1065页
资料共1065页,剩余部分请下载后查看
Cover
Copyright Page
Acknowledgments
About the Authors
Contents
Preface
1 Introduction to Computers and C++
1.1 Introduction
1.2 Computers and the Internet in Industry and Research
1.3 Hardware and Software
1.3.1 Moore's Law
1.3.2 Computer Organization
1.4 Data Hierarchy
1.5 Machine Languages, Assembly Languages and High-Level Languages
1.6 C++
1.7 Programming Languages
1.8 Introduction to Object Technology
1.9 Typical C++ Development Environment
1.10 Test-Driving a C++ Application
1.11 Operating Systems
1.11.1 Windows—A Proprietary Operating System
1.11.2 Linux—An Open-Source Operating System
1.11.3 Apple's OS X; Apple's iOS for iPhone®, iPad® and iPod Touch® Devices
1.11.4 Google's Android
1.12 The Internet and World Wide Web
1.13 Some Key Software Development Terminology
1.14 C++11 and the Open Source Boost Libraries
1.15 Keeping Up to Date with Information Technologies
1.16 Web Resources
2 Introduction to C++ Programming; Input/Output and Operators
2.1 Introduction
2.2 First Program in C++: Printing a Line of Text
2.3 Modifying Our First C++ Program
2.4 Another C++ Program: Adding Integers
2.5 Memory Concepts
2.6 Arithmetic
2.7 Decision Making: Equality and Relational Operators
2.8 Wrap-Up
3 Introduction to Classes, Objects and Strings
3.1 Introduction
3.2 Defining a Class with a Member Function
3.3 Defining a Member Function with a Parameter
3.4 Data Members, set Member Functions and get Member Functions
3.5 Initializing Objects with Constructors
3.6 Placing a Class in a Separate File for Reusability
3.7 Separating Interface from Implementation
3.8 Validating Data with set Functions
3.9 Wrap-Up
4 Control Statements: Part 1; Assignment, ++ and -- Operators
4.1 Introduction
4.2 Algorithms
4.3 Pseudocode
4.4 Control Structures
4.5 if Selection Statement
4.6 if…else Double-Selection Statement
4.7 while Repetition Statement
4.8 Formulating Algorithms: Counter-Controlled Repetition
4.9 Formulating Algorithms: Sentinel-Controlled Repetition
4.10 Formulating Algorithms: Nested Control Statements
4.11 Assignment Operators
4.12 Increment and Decrement Operators
4.13 Wrap-Up
5 Control Statements: Part 2; Logical Operators
5.1 Introduction
5.2 Essentials of Counter-Controlled Repetition
5.3 for Repetition Statement
5.4 Examples Using the for Statement
5.5 do…while Repetition Statement
5.6 switch Multiple-Selection Statement
5.7 break and continue Statements
5.8 Logical Operators
5.9 Confusing the Equality (==) and Assignment (=) Operators
5.10 Structured Programming Summary
5.11 Wrap-Up
6 Functions and an Introduction to Recursion
6.1 Introduction
6.2 Program Components in C++
6.3 Math Library Functions
6.4 Function Definitions with Multiple Parameters
6.5 Function Prototypes and Argument Coercion
6.6 C++ Standard Library Headers
6.7 Case Study: Random Number Generation
6.8 Case Study: Game of Chance; Introducing enum
6.9 C++11 Random Numbers
6.10 Storage Classes and Storage Duration
6.11 Scope Rules
6.12 Function Call Stack and Activation Records
6.13 Functions with Empty Parameter Lists
6.14 Inline Functions
6.15 References and Reference Parameters
6.16 Default Arguments
6.17 Unary Scope Resolution Operator
6.18 Function Overloading
6.19 Function Templates
6.20 Recursion
6.21 Example Using Recursion: Fibonacci Series
6.22 Recursion vs. Iteration
6.23 Wrap-Up
7 Class Templates array and vector; Catching Exceptions
7.1 Introduction
7.2 arrays
7.3 Declaring arrays
7.4 Examples Using arrays
7.4.1 Declaring an array and Using a Loop to Initialize the array's Elements
7.4.2 Initializing an array in a Declaration with an Initializer List
7.4.3 Specifying an array's Size with a Constant Variable and Setting array Elements with Calculations
7.4.4 Summing the Elements of an array
7.4.5 Using Bar Charts to Display array Data Graphically
7.4.6 Using the Elements of an array as Counters
7.4.7 Using arrays to Summarize Survey Results
7.4.8 Static Local arrays and Automatic Local arrays
7.5 Range-Based for Statement
7.6 Case Study: Class GradeBook Using an array to Store Grades
7.7 Sorting and Searching arrays
7.8 Multidimensional arrays
7.9 Case Study: Class GradeBook Using a Two-Dimensional array
7.10 Introduction to C++ Standard Library Class Template vector
7.11 Wrap-Up
8 Pointers
8.1 Introduction
8.2 Pointer Variable Declarations and Initialization
8.3 Pointer Operators
8.4 Pass-by-Reference with Pointers
8.5 Built-In Arrays
8.6 Using const with Pointers
8.6.1 Nonconstant Pointer to Nonconstant Data
8.6.2 Nonconstant Pointer to Constant Data
8.6.3 Constant Pointer to Nonconstant Data
8.6.4 Constant Pointer to Constant Data
8.7 sizeof Operator
8.8 Pointer Expressions and Pointer Arithmetic
8.9 Relationship Between Pointers and Built-In Arrays
8.10 Pointer-Based Strings
8.11 Wrap-Up
9 Classes: A Deeper Look; Throwing Exceptions
9.1 Introduction
9.2 Time Class Case Study
9.3 Class Scope and Accessing Class Members
9.4 Access Functions and Utility Functions
9.5 Time Class Case Study: Constructors with Default Arguments
9.6 Destructors
9.7 When Constructors and Destructors Are Called
9.8 Time Class Case Study: A Subtle Trap—Returning a Reference or a Pointer to a private Data Member
9.9 Default Memberwise Assignment
9.10 const Objects and const Member Functions
9.11 Composition: Objects as Members of Classes
9.12 friend Functions and friend Classes
9.13 Using the this Pointer
9.14 static Class Members
9.15 Wrap-Up
10 Operator Overloading; Class string
10.1 Introduction
10.2 Using the Overloaded Operators of Standard Library Class string
10.3 Fundamentals of Operator Overloading
10.4 Overloading Binary Operators
10.5 Overloading the Binary Stream Insertion and Stream Extraction Operators
10.6 Overloading Unary Operators
10.7 Overloading the Unary Prefix and Postfix ++ and -- Operators
10.8 Case Study: A Date Class
10.9 Dynamic Memory Management
10.10 Case Study: Array Class
10.10.1 Using the Array Class
10.10.2 Array Class Definition
10.11 Operators as Member vs. Non-Member Functions
10.12 Converting Between Types
10.13 explicit Constructors and Conversion Operators
10.14 Overloading the Function Call Operator ()
10.15 Wrap-Up
11 Object-Oriented Programming: Inheritance
11.1 Introduction
11.2 Base Classes and Derived Classes
11.3 Relationship between Base and Derived Classes
11.3.1 Creating and Using a CommissionEmployee Class
11.3.2 Creating a BasePlusCommissionEmployee Class Without Using Inheritance
11.3.3 Creating a CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy
11.3.4 CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy Using protected Data
11.3.5 CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy Using private Data
11.4 Constructors and Destructors in Derived Classes
11.5 public, protected and private Inheritance
11.6 Software Engineering with Inheritance
11.7 Wrap-Up
12 Object-Oriented Programming: Polymorphism
12.1 Introduction
12.2 Introduction to Polymorphism: Polymorphic Video Game
12.3 Relationships Among Objects in an Inheritance Hierarchy
12.3.1 Invoking Base-Class Functions from Derived-Class Objects
12.3.2 Aiming Derived-Class Pointers at Base-Class Objects
12.3.3 Derived-Class Member-Function Calls via Base-Class Pointers
12.3.4 Virtual Functions and Virtual Destructors
12.4 Type Fields and switch Statements
12.5 Abstract Classes and Pure virtual Functions
12.6 Case Study: Payroll System Using Polymorphism
12.6.1 Creating Abstract Base Class Employee
12.6.2 Creating Concrete Derived Class SalariedEmployee
12.6.3 Creating Concrete Derived Class CommissionEmployee
12.6.4 Creating Indirect Concrete Derived Class BasePlusCommissionEmployee
12.6.5 Demonstrating Polymorphic Processing
12.7 (Optional) Polymorphism, Virtual Functions and Dynamic Binding "Under the Hood"
12.8 Case Study: Payroll System Using Polymorphism and Runtime Type Information with Downcasting, dynamic_cast, typeid and type_info
12.9 Wrap-Up
13 Stream Input/Output: A Deeper Look
13.1 Introduction
13.2 Streams
13.2.1 Classic Streams vs. Standard Streams
13.2.2 iostream Library Headers
13.2.3 Stream Input/Output Classes and Objects
13.3 Stream Output
13.3.1 Output of char * Variables
13.3.2 Character Output Using Member Function put
13.4 Stream Input
13.4.1 get and getline Member Functions
13.4.2 istream Member Functions peek, putback and ignore
13.4.3 Type-Safe I/O
13.5 Unformatted I/O Using read, write and gcount
13.6 Introduction to Stream Manipulators
13.6.1 Integral Stream Base: dec, oct, hex and setbase
13.6.2 Floating-Point Precision (precision, setprecision)
13.6.3 Field Width (width, setw)
13.6.4 User-Defined Output Stream Manipulators
13.7 Stream Format States and Stream Manipulators
13.7.1 Trailing Zeros and Decimal Points (showpoint)
13.7.2 Justification (left, right and internal)
13.7.3 Padding (fill, setfill)
13.7.4 Integral Stream Base (dec, oct, hex, showbase)
13.7.5 Floating-Point Numbers; Scientific and Fixed Notation (scientific, fixed)
13.7.6 Uppercase/Lowercase Control (uppercase)
13.7.7 Specifying Boolean Format (boolalpha)
13.7.8 Setting and Resetting the Format State via Member Function flags
13.8 Stream Error States
13.9 Tying an Output Stream to an Input Stream
13.10 Wrap-Up
14 File Processing
14.1 Introduction
14.2 Files and Streams
14.3 Creating a Sequential File
14.4 Reading Data from a Sequential File
14.5 Updating Sequential Files
14.6 Random-Access Files
14.7 Creating a Random-Access File
14.8 Writing Data Randomly to a Random-Access File
14.9 Reading from a Random-Access File Sequentially
14.10 Case Study: A Transaction-Processing Program
14.11 Object Serialization
14.12 Wrap-Up
15 Standard Library Containers and Iterators
15.1 Introduction
15.2 Introduction to Containers
15.3 Introduction to Iterators
15.4 Introduction to Algorithms
15.5 Sequence Containers
15.5.1 vector Sequence Container
15.5.2 list Sequence Container
15.5.3 deque Sequence Container
15.6 Associative Containers
15.6.1 multiset Associative Container
15.6.2 set Associative Container
15.6.3 multimap Associative Container
15.6.4 map Associative Container
15.7 Container Adapters
15.7.1 stack Adapter
15.7.2 queue Adapter
15.7.3 priority_queue Adapter
15.8 Class bitset
15.9 Wrap-Up
16 Standard Library Algorithms
16.1 Introduction
16.2 Minimum Iterator Requirements
16.3 Algorithms
16.3.1 fill, fill_n, generate and generate_n
16.3.2 equal, mismatch and lexicographical_compare
16.3.3 remove, remove_if, remove_copy and remove_copy_if
16.3.4 replace, replace_if, replace_copy and replace_copy_if
16.3.5 Mathematical Algorithms
16.3.6 Basic Searching and Sorting Algorithms
16.3.7 swap, iter_swap and swap_ranges
16.3.8 copy_backward, merge, unique and reverse
16.3.9 inplace_merge, unique_copy and reverse_copy
16.3.10 Set Operations
16.3.11 lower_bound, upper_bound and equal_range
16.3.12 Heapsort
16.3.13 min, max, minmax and minmax_element
16.4 Function Objects
16.5 Lambda Expressions
16.6 Standard Library Algorithm Summary
16.7 Wrap-Up
17 Exception Handling: A Deeper Look
17.1 Introduction
17.2 Example: Handling an Attempt to Divide by Zero
17.3 Rethrowing an Exception
17.4 Stack Unwinding
17.5 When to Use Exception Handling
17.6 Constructors, Destructors and Exception Handling
17.7 Exceptions and Inheritance
17.8 Processing new Failures
17.9 Class unique_ptr and Dynamic Memory Allocation
17.10 Standard Library Exception Hierarchy
17.11 Wrap-Up
18 Introduction to Custom Templates
18.1 Introduction
18.2 Class Templates
18.3 Function Template to Manipulate a Class-Template Specialization Object
18.4 Nontype Parameters
18.5 Default Arguments for Template Type Parameters
18.6 Overloading Function Templates
18.7 Wrap-Up
19 Custom Templatized Data Structures
19.1 Introduction
19.2 Self-Referential Classes
19.3 Linked Lists
19.4 Stacks
19.5 Queues
19.6 Trees
19.7 Wrap-Up
20 Searching and Sorting
20.1 Introduction
20.2 Searching Algorithms
20.2.1 Linear Search
20.2.2 Binary Search
20.3 Sorting Algorithms
20.3.1 Insertion Sort
20.3.2 Selection Sort
20.3.3 Merge Sort (A Recursive Implementation)
20.4 Wrap-Up
21 Class string and String Stream Processing: A Deeper Look
21.1 Introduction
21.2 string Assignment and Concatenation
21.3 Comparing strings
21.4 Substrings
21.5 Swapping strings
21.6 string Characteristics
21.7 Finding Substrings and Characters in a string
21.8 Replacing Characters in a string
21.9 Inserting Characters into a string
21.10 Conversion to Pointer-Based char * Strings
21.11 Iterators
21.12 String Stream Processing
21.13 C++11 Numeric Conversion Functions
21.14 Wrap-Up
22 Bits, Characters, C Strings and structs
22.1 Introduction
22.2 Structure Definitions
22.3 typedef
22.4 Example: Card Shuffling and Dealing Simulation
22.5 Bitwise Operators
22.6 Bit Fields
22.7 Character-Handling Library
22.8 C String-Manipulation Functions
22.9 C String-Conversion Functions
22.10 Search Functions of the C String-Handling Library
22.11 Memory Functions of the C String-Handling Library
22.12 Wrap-Up
23 Other Topics
23.1 Introduction
23.2 const_cast Operator
23.3 mutable Class Members
23.4 namespaces
23.5 Operator Keywords
23.6 Pointers to Class Members (.* and ->*)
23.7 Multiple Inheritance
23.8 Multiple Inheritance and virtual Base Classes
23.9 Wrap-Up
List of Chapters on the Web
A: Operator Precedence and Associativity
B: ASCII Character Set
C: Fundamental Types
D: Number Systems
D.1 Introduction
D.2 Abbreviating Binary Numbers as Octal and Hexadecimal Numbers
D.3 Converting Octal and Hexadecimal Numbers to Binary Numbers
D.4 Converting from Binary, Octal or Hexadecimal to Decimal
D.5 Converting from Decimal to Binary, Octal or Hexadecimal
D.6 Negative Binary Numbers: Two's Complement Notation
E Preprocessor
E.1 Introduction
E.2 #include Preprocessing Directive
E.3 #define Preprocessing Directive: Symbolic Constants
E.4 #define Preprocessing Directive: Macros
E.5 Conditional Compilation
E.6 #error and #pragma Preprocessing Directives
E.7 Operators # and ##
E.8 Predefined Symbolic Constants
E.9 Assertions
E.10 Wrap-Up
List of Appendices on the Web
Index
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
ONLINE ACCESS Thank you for purchasing a new copy of C++ How to Program, Ninth Edition. Your textbook includes twelve months of prepaid access to the book’s Companion Website. This prepaid subscription provides you with full access to the following student support areas: • VideoNotes are step-by-step video tutorials specifically designed to enhance the programming concepts presented in this textbook • Premium Web Chapters and Appendices • Source Code Use a coin to scratch off the coating and reveal your student access code. Do not use a knife or other sharp object as it may damage the code. To access the C++ How to Program, Ninth Edition, Companion Website for the first time, you will need to register online using a computer with an Internet connection and a web browser. The process takes just a couple of minutes and only needs to be completed once. 1. Go to http://www.pearsonhighered.com/deitel/ 2. Click on Companion Website. 3. Click on the Register button. 4. On the registration page, enter your student access code* found beneath the scratch-off panel. Do not type the dashes. You can use lower- or uppercase. 5. Follow the on-screen instructions. If you need help at any time during the online registration process, simply click the Need Help? icon. 6. Once your personal Login Name and Password are confirmed, you can begin using the C++ How to Program Companion Website! To log in after you have registered: You only need to register for this Companion Website once. After that, you can log in any time at http://www.pearsonhighered.com/deitel/ by providing your Login Name and Password when prompted. *Important: The access code can only be used once. This subscription is valid for twelve months upon activation and is not transferable. If this access code has already been revealed, it may no longer be valid. If this is the case, you can purchase a subscription by going to http:// www.pearsonhighered.com/deitel/ and following the on-screen instructions. Continued from Back Cover ❝It’s great that the text introduces object-oriented programming early. The car analogy was well-thought out. Meticulous treatment of control structures. The virtual function figure and corresponding explanation in the Polymorphism chapter is thorough and truly commendable.~ —Gregory Dai, eBay ❝The example-driven presentation is enriched by the optional OO design case study that contextualizes the material in a software engineering project.~ —Gavin Osborne, Saskatchewan Institute of Applied Science and Technology ❝The Object-Oriented Programming: Inheritance chapter is well done. Excellent introduction to polymorphism.~ —David Topham, Ohlone College ❝The overview of computing is about the right depth and breadth for an intro course.~ —Robert C. Seacord, Secure Coding Manager at SEI/CERT, author of Secure Coding in C and C++ ❝Thorough and detailed coverage of exceptions from an object-oriented point of view.~ —Dean Mathias, Utah State University ❝Introducing the UML early is a great idea.~ —Raymond Stephenson, Microsoft ❝Good use of diagrams, especially of the activation call stack and recursive functions.~ —Amar Raheja, California State Polytechnic University, Pomona ❝Terrific discussion of pointers—the best I have seen.~ —Anne B. Horton, Lockheed Martin ❝I especially value the code examples and diagrams. Great coverage of OOP. Nice detail in [Intro to Classes]—students can learn so much from it; I love that every line of code is explained and that UML class diagrams are given. I really like the Structured Programming Summary. Good visuals provided for what’s going on in memory [for pass-by-value and pass-by-reference]. The [Inheritance] examples nicely reinforce the concepts. I love the description of [a possible] polymorphic video game.~ —Linda M. Krause, Elmhurst College ❝A good whirlwind tour [in Chapter 1] of what computers are, the history of the computer industry and some high-level introductory material on C++. [Chapter 2] is a gentle introduction to C++ that gradually gets soon-to-be programmers learning just enough to be able to do interest- ing things right away. The [Chapter 3, Introduction to Classes, Objects and Strings] examples are solid.~—Dean Michael Berris, Google ❝A good control statements chapter; the discussions of increment ops, {} initialization and floating point data formatting are excellent; novices will benefit from these sections. The discussion about stack memory, storage classes and the function call mechanism is great. I enjoyed the recursion section. The pointers and arrays chapter manages to explain something that’s quite difficult to teach: the elusive nature of pointers. [Classes: A Deeper Look; Throwing Exceptions] is good and well-focused. The operator overloading chapter explains the topic clearly and builds a convincing, realistic class [Array] that demonstrates the capabilities of OOD and C++. [Inheritance] is short, to the point and very clear. [Standard Library Containers] is excellent, up to date, accurate, concise and readable; I really enjoyed it.~ —Danny Kalev, C++ expert, Certified System Analyst and former member of C++ Standards Committee ❝Clearly explains control structures. The [Functions] code examples exemplify the chapter content; the discussion was very good and the exer- cises had good variation in difficulty. [Arrays and Vectors] was really good; I like the idea of std::array [instead of built-in arrays] by default. [Exception Handling] was short, sweet, to the point and accurate.~ —James McNellis, Microsoft ❝An accurate and complete C++ book that everybody can understand. A ‘must-have.’ Novices and advanced programmers will find this book an excellent tool for learning C++. Really fun and interesting exercises (Knight’s Tour, Eight Queens, etc.). Easy-to-understand string examples and interesting exercises. I especially liked the Quicksort explanation. The Simpletron exercises are brilliant.~ —José Antonio González Seco, Parliament of Andalusia ❝I really like the Making a Difference exercises. The [dice and card games] get students excited.~ —Virginia Bailey, Jackson State University ❝Provides a complete basis of fundamental instruction in all core aspects of C++. A solid overview of Stream I/O.~ —Peter DePasquale, The College of New Jersey ❝Great coverage of polymorphism and how the compiler implements polymorphism ‘under the hood.’~ —Ed James-Beckham, Borland ❝A nice introduction to searching and sorting, and Big-O.~ —Robert Myers, Florida State University ❝Will get you up and running quickly with the [smart pointers] and regular expression libraries.~ —Ed Brey, Kohler Co. ❝The most thorough C++ treatment I’ve seen. Replete with real-world case studies covering the full software development lifecycle. Code examples are extraordinary!~—Terrell Hull, Logicalis Integration Solutions
Deitel® Series Page How To Program Series Android How to Program C How to Program, 7/E C++ How to Program, 9/E C++ How to Program, Late Objects Version, 7/E Java™ How to Program, 9/E Java™ How to Program, Late Objects Version, 8/E Internet & World Wide Web How to Program, 5/E Visual Basic® 2012 How to Program Visual C#® 2012 How to Program, 3/E Visual C++® 2008 How to Program, 2/E Small Java™ How to Program, 6/E Small C++ How to Program, 5/E Simply Series Simply C++: An App-Driven Tutorial Approach Simply Java™ Programming: An App-Driven Simply Visual Basic® 2010, 4/E: An App-Driven Tutorial Approach Tutorial Approach CourseSmart Web Books www.deitel.com/books/CourseSmart/ C++ How to Program, 7/E, 8/E & 8/E Simply C++: An App-Driven Tutorial Approach Java™ How to Program, 7/E, 8/E & 9/E Simply Visual Basic 2010: An App-Driven Approach, 4/E Visual Basic® 2012 How to Program Visual Basic® 2010 How to Program Visual C#® 2012 How to Program, 5/E Visual C#® 2010 How to Program, 4/E Deitel® Developer Series C++ for Programmers, 2/E Android for Programmers: An App-Driven Approach C# 2010 for Programmers, 3/E Dive Into® iOS 6: An App-Driven Approach iOS 6 for Programmers: An App-Driven Approach Java™ for Programmers, 2/E JavaScript for Programmers LiveLessons Video Learning Products www.deitel.com/books/LiveLessons/ Android® App Development Fundamentals C++ Fundamentals C# Fundamentals iOS 6 App Development Fundamentals Java™ Fundamentals JavaScript Fundamentals Visual Basic Fundamentals To receive updates on Deitel publications, Resource Centers, training courses, partner offers and more, please register for the free Deitel® Buzz Online e-mail newsletter at: www.deitel.com/newsletter/subscribe.html and join the Deitel communities on Twitter® @deitel Facebook® facebook.com/DeitelFan and Google+ gplus.to/deitel To communicate with the authors, send e-mail to: deitel@deitel.com For information on government and corporate Dive-Into® Series on-site seminars offered by Deitel & Associates, Inc. worldwide, visit: www.deitel.com/training/ or write to deitel@deitel.com For continuing updates on Prentice Hall/Deitel publications visit: www.deitel.com www.pearsonhighered.com/deitel/ Visit the Deitel Resource Centers that will help you master programming languages, software develop- ment, Android and iPhone/iPad app development, and Internet- and web-related topics: www.deitel.com/ResourceCenters.html
cpphtp9_titlepages.fm Page iii Friday, January 4, 2013 6:37 AM Paul Deitel Deitel & Associates, Inc. Harvey Deitel Deitel & Associates, Inc.
Vice President and Editorial Director: Marcia J. Horton Executive Editor: Tracy Johnson Associate Editor: Carole Snyder Director of Marketing: Christy Lesko Marketing Manager: Yezan Alayan Marketing Assistant: Jon Bryant Director of Production: Erin Gregg Managing Editor: Scott Disanno Associate Managing Editor: Robert Engelhardt Operations Specialist: Lisa McDowell Art Director: Anthony Gemmellaro Cover Design: Abbey S. Deitel, Harvey M. Deitel, Anthony Gemmellaro Cover Photo Credit: © Shutterstock/Sean Gladwell Media Project Manager: Renata Butera Credits and acknowledgments borrowed from other sources and reproduced, with permission, in this textbook appear on page vi. The authors and publisher of this book have used their best efforts in preparing this book. These efforts include the development, research, and testing of the theories and programs to determine their effectiveness. The authors and pub- lisher make no warranty of any kind, expressed or implied, with regard to these programs or to the documentation contained in this book. The authors and publisher shall not be liable in any event for incidental or consequential dam- ages in connection with, or arising out of, the furnishing, performance, or use of these programs. Copyright © 2014, 2012, 2010 Pearson Education, Inc., publishing as Prentice Hall. All rights reserved. Manufac- tured in the United States of America. This publication is protected by Copyright, and permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission(s) to use material from this work, please submit a written request to Pearson Education, Inc., One Lake Street, Upper Saddle River, New Jersey 07458, or you may fax your request to 201-236-3290. Many of the designations by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed in initial caps or all caps. Library of Congress Cataloging-in-Publication Data on file. 10 9 8 7 6 5 4 3 2 1 ISBN-10: 0-13-337871-3 ISBN-13: 978-0-13-337871-9
In memory of Dennis Ritchie, creator of the C programming language— one of the key languages that inspired C++. Paul and Harvey Deitel
Trademarks DEITEL, the double-thumbs-up bug and DIVE INTO are registered trademarks of Deitel and Associates, Inc. Carnegie Mellon Software Engineering Institute™ is a trademark of Carnegie Mellon University. CERT® is registered in the U.S. Patent and Trademark Office by Carnegie Mellon University. Microsoft® and Windows® are registered trademarks of the Microsoft Corporation in the U.S.A. and other countries. Screen shots and icons reprinted with permission from the Microsoft Corporation. This book is not sponsored or endorsed by or affiliated with the Microsoft Corporation. UNIX is a registered trademark of The Open Group. Throughout this book, trademarks are used. Rather than put a trademark symbol in every occurrence of a trademarked name, we state that we are using the names in an editorial fashion only and to the benefit of the trademark owner, with no intention of infringement of the trademark.
分享到:
收藏