| 作者 |
| (美)Paul Deitel(保罗? 戴特尔) Harvey Deitel(哈维? 戴特尔) |
| 丛书名 |
| 国外计算机科学教材系列 |
| 出版社 |
| 电子工业出版社 |
| ISBN |
| 9787121343377 |
| 简要 |
| 简介 |
| 内容简介书籍计算机书籍 本书是全球畅销的C语言教程之一。全书系统地介绍了4种当今流行的程序设计方法——面向过程、基于对象、面向对象以及泛型编程,内容全面、生动、易懂,作者由浅入深地介绍了结构化编程及软件工程的基本概念,从简单的概念到最终的完整的语言描述,清晰、准确、透彻、详细地讲解了C语言,尤其注重程序设计思想和方法的介绍。相对于上一版,这一版在内容方面新增加了C安全程序设计、更上一层楼”习题集,更新了C++和面向对象程序设计、基于Allegro的游戏编程、C99标准介绍等内容。 |
| 目录 |
| Contents Chapter 1 Introduction to Computers, the Internet and the Web 1 1.1 Introduction 2 1.2 Computers and the Internet in Industry and Research 2 1.3 Hardware and Software 4 1.4 Data Hierarchy 6 1.5 Programming Languages 7 1.6 The C Programming Language 7 1.7 C Standard Library 9 1.8 C++ and Other C-Based Languages 9 1.9 Object Technology 10 1.10 Typical C Program Development Environment 12 1.11 Test-Driving a C Application in Windows, Linux and Mac OS X 14 1.12 Operating Systems 21 1.13 The Internet and World Wide Web 23 1.14 Some Key Software Development Terminology 24 1.15 Keeping Up-to-Date with Information Technologies 25 1.16 Web Resources 26 Chapter 2 Introduction to C Programming 32 2.1 Introduction 32 2.2 A Simple C Program: Printing a Line of Text 32 2.3 Another Simple C Program: Adding Two Integers 36 2.4 Memory Concepts 39 2.5 Arithmetic in C 40 2.6 Decision Making: Equality and Relational Operators 43 2.7 Secure C Programming 46 Chapter 3 Structured Program Development in C 58 3.1 Introduction 58 3.2 Algorithms 59 3.3 Pseudocode 59 3.4 Control Structures 59 3.5 The if Selection Statement 61 3.6 The if…else Selection Statement 62 3.7 The while Repetition Statement 65 3.8 Formulating Algorithms Case Study 1: CounterControlled Repetition 66 3.9 Formulating Algorithms with Top-Down, Stepwise Refinement Case Study 2: Sentinel-Controlled Repetition 67 3.10 Formulating Algorithms with Top-Down, Stepwise Refinement Case Study 3: Nested Control Statements 72 3.11 Assignment Operators 75 3.12 Increment and Decrement Operators 76 3.13 Secure C Programming 78 Chapter 4 C Program Control 95 4.1 Introduction 95 4.2 Repetition Essentials 96 4.3 Counter-Controlled Repetition 96 4.4 for Repetition Statement 98 4.5 for Statement: Notes and Observations 100 4.6 Examples Using the for Statement 100 4.7 switch Multiple-Selection Statement 103 4.8 do…while Repetition Statement 108 4.9 break and continue Statements 109 4.10 Logical Operators 111 4.11 Confusing Equality (==) and Assignment (=) Operators 113 4.12 Structured Programming Summary 114 4.13 Secure C Programming 118 Chapter 5 C Functions 132 5.1 Introduction 133 5.2 Program Modules in C 133 5.3 Math Library Functions 134 5.4 Functions 135 5.5 Function Definitions 135 5.6 Function Prototypes: A Deeper Look 139 5.7 Function Call Stack and Stack Frames 141 5.8 Headers 143 5.9 Passing Arguments By Value and By Reference 144 5.10 Random Number Generation 145 5.11 Example: A Game of Chance 148 5.12 Storage Classes 151 5.13 Scope Rules 152 5.14 Recursion 155 5.15 Example Using Recursion: Fibonacci Series 158 5.16 Recursion vs. Iteration 160 5.17 Secure C Programming 162 Chapter 6 C Arrays 181 6.1 Introduction 181 6.2 Arrays 182 6.3 Defining Arrays 182 6.4 Array Examples 183 6.5 Passing Arrays to Functions 193 6.6 Sorting Arrays 196 6.7 Case Study: Computing Mean, Median and Mode Using Arrays 198 6.8 Searching Arrays 202 6.9 Multidimensional Arrays 206 6.10 Variable-Length Arrays 211 6.11 Secure C Programming 213 Chapter 7 C Pointers 230 7.1 Introduction 231 7.2 Pointer Variable Definitions and Initialization 231 7.3 Pointer Operators 232 7.4 Passing Arguments to Functions by Reference 233 7.5 Using the const Qualifier with Pointers 235 7.6 Bubble Sort Using Pass-by-Reference 241 7.7 sizeof Operator 243 7.8 Pointer Expressions and Pointer Arithmetic 245 7.9 Relationship between Pointers and Arrays 247 7.10 Arrays of Pointers 250 7.11 Case Study: Card Shuffling and Dealing Simulation 251 7.12 Pointers to Functions 254 7.13 Secure C Programming 258 Chapter 8 C Characters and Strings 277 8.1 Introduction 278 8.2 Fundamentals of Strings and Characters 278 8.3 Character-Handling Library 280 8.4 String-Conversion Functions 284 8.5 Standard Input/Output Library Functions 286 8.6 String-Manipulation Functions of the StringHandling Library 289 8.7 Comparison Functions of the String-Handling Library 291 8.8 Search Functions of the String-Handling Library 292 8.9 Memory Functions of the String-Handling Library 297 8.10 Other Functions of the String-Handling Library 300 8.11 Secure C Programming 301 Chapter 9 C Formatted Input/Output 314 9.1 Introduction 314 9.2 Streams 315 9.3 Formatting Output with printf 315 9.4 Printing Integers 315 9.5 Printing Floating-Point Numbers 316 9.6 Printing Strings and Characters 318 9.7 Other Conversion Specifiers 318 9.8 Printing with Field Widths and Precision 319 9.9 Using Flags in the printf Format Control String 321 9.10 Printing Literals and Escape Sequences 323 9.11 Reading Formatted Input with scanf 323 9.12 Secure C Programming 328 Chapter 10 C Structures, Unions, Bit Manipulation and Enumerations 335 10.1 Introduction 336 10.2 Structure Definitions 336 10.3 Initializing Structures 338 10.4 Accessing Structure Members 338 10.5 Using Structures with Functions 340 10.6 typedef 340 10.7 Example: High-Performance Card Shuffling and Dealing Simulation 341 10.8 Unions 343 10.9 Bitwise Operators 344 10.10 Bit Fields 351 10.11 Enumeration Constants 353 10.12 Secure C Programming 355 Chapter 11 C File Processing 365 11.1 Introduction 365 11.2 Files and Streams 366 11.3 Creating a Sequential-Access File 366 11.4 Reading Data from a Sequential-Access File 370 11.5 Random-Access Files 373 11.6 Creating a Random-Access File 374 11.7 Writing Data Randomly to a Random-Access File 375 11.8 Reading Data from a Random-Access File 377 11.9 Case Study: Transaction-Processing Program 379 11.10 Secure C Programming 383 Chapter 12 C Data Structures 393 12.1 Introduction 394 12.2 Self-Referential Structures 394 12.3 Dynamic Memory Allocation 395 12.4 Linked Lists 396 12.5 Stacks 402 12.6 Queues 406 12.7 Trees 411 12.8 Secure C Programming 415 Chapter 13 C Preprocessor 427 13.1 Introduction 427 13.2 #include Preprocessor Directive 428 13.3 #define Preprocessor Directive: Symbolic Constants 428 13.4 #define Preprocessor Directive: Macros 429 13.5 Conditional Compilation 430 13.6 #error and #pragma Preprocessor Directives 431 13.7 # and ## Operators 432 13.8 Line Numbers 432 13.9 Predefined Symbolic Constants 432 13.10 Assertions 433 13.11 Secure C Programming 433 Chapter 14 Other C Topics 438 14.1 Introduction 438 14.2 Redirecting I/O 438 14.3 Variable-Length Argument Lists 439 14.4 Using Command-Line Arguments 441 14.5 Notes on Compiling Multiple-Source-File Programs 442 14.6 Program Termination with exit and atexit 443 14.7 Suffixes for Integer and Floating-Point Literals 444 14.8 Signal Handling 445 14.9 Dynamic Memory Allocation: Functions calloc and realloc 447 14.10 Unconditional Branching with goto 447 Chapter 15 C++ as a Better C; Introducing Object Technology 453 15.1 Introduction 454 15.2 C++ 454 15.3 A Simple Program: Adding Two Integers 454 15.4 C++ Standard Library 456 15.5 Header Files 457 15.6 Inline Functions 458 15.7 References and Reference Parameters 460 15.8 Empty Parameter Lists 464 15.9 Default Arguments 464 15.10 Unary Scope Resolution Operator 466 15.11 Function Overloading 467 15.12 Function Templates 469 15.13 Introduction to C++ Standard Library Class Template vector 471 15.14 Introduction to Object Technology and the UML 476 15.15 Wrap-Up 479 Chapter 16 Introduction to Classes, Objects and Strings 486 16.1 Introduction 486 16.2 Defining a Class with a Member Function 487 16.3 Defining a Member Function with a Parameter 489 16.4 Data Members, set Functions and get Functions 492 16.5 Initializing Objects with Constructors 496 16.6 Placing a Class in a Separate File for Reusability 499 16.7 Separating Interface from Implementation 502 16.8 Validating Data with set Functions 507 16.9 Wrap-Up 510 Chapter 17 Classes: A Deeper Look, Part 1 517 17.1 Introduction 517 17.2 Time Class Case Study 518 17.3 Class Scope and Accessing Class Members 524 17.4 Separating Interface from Implementation 525 17.5 Access Functions and Utility Functions 526 17.6 Time Class Case Study: Constructors with Default Arguments 528 17.7 Destructors 532 17.8 When Constructors and Destructors Are Called 532 17.9 Time Class Case Study: A Subtle Trap—Returning a Reference to a private Data Member 535 17.10 Default Memberwise Assignment 537 17.11 Wrap-Up 539 Chapter 18 Classes: A Deeper Look, Part 2 545 18.1 Introduction 545 18.2 const (Constant) Objects and const Member Functions 546 18.3 Composition: Objects as Members of Classes 551 18.4 friend Functions and friend Classes 556 18.5 Using the this Pointer 558 18.6 static Class Members 562 18.7 Proxy Classes 565 18.8 Wrap-Up 568 Chapter 19 Operator Overloading; Class string 574 19.1 Introduction 574 19.2 Using the Overloaded Operators of Standard Library Class string 575 19.3 Fundamentals of Operator Overloading 578 19.4 Overloading Binary Operators 579 19.5 Overloading the Binary Stream Insertion and Stream Extraction Operators 579 19.6 Overloading Unary Operators 583 19.7 Overloading the Unary Prefix and Postfix ++ and --Operators 583 19.8 Case Study: A Date Class 584 19.9 Dynamic Memory Management 588 19.10 Case Study: Array Class 590 19.11 Operators as Member Functions vs. Non-Member Functions 599 19.12 Converting between Types 600 19.13 explicit Constructors 601 19.14 Building a String Class 603 19.15 Wrap-Up 603 Chapter 20 Object-Oriented Programming: Inheritance 614 20.1 Introduction 615 20.2 Base Classes and Derived Classes 615 20.3 protected Members 617 20.4 Relationship between Base Classes and Derived Classes 617 20.5 Constructors and Destructors in Derived Classes 635 20.6 public, protected and private Inheritance 636 20.7 Software Engineering with Inheritance 636 20.8 Wrap-Up 637 Chapter 21 Object-Oriented Programming: Polymorphism 642 21.1 Introduction 643 21.2 Introduction to Polymorphism: Polymorphic Video Game 643 21.3 Relationships Among Objects in an Inheritance Hierarchy 644 21.4 Type Fields and switch Statements 653 21.5 Abstract Classes and Pure virtual Functions 654 21.6 Case Study: Payroll System Using Polymorphism 656 21.7 (Optional) Polymorphism, Virtual Functions and Dynamic Binding “Under the Hood” 667 21.8 Case Study: Payroll System Using Polymorphism and Runtime Type Information with Downcasting, dynamic_cast, typeid and type_info 670 21.9 Virtual Destructors 672 21.10 Wrap-Up 673 Chapter 22 Templates 679 22.1 Introduction 679 22.2 Function Templates 680 22.3 Overloading Function Templates 682 22.4 Class Templates 683 22.5 Nontype Parameters and Default Types for Class Templates 687 22.6 Wrap-Up 688 Chapter 23 Stream Input/Output 692 23.1 Introduction 693 23.2 Streams 693 23.3 Stream Output 696 23.4 Stream Input 697 23.5 Unformatted I/O Using read, write and gcount 700 23.6 Introduction to Stream Manipulators 701 23.7 Stream Format States and Stream Manipulators 705 23.8 Stream Error States 712 23.9 Tying an Output Stream to an Input Stream 714 23.10 Wrap-Up 714 Chapter 24 Exception Handling: A Deeper Look 723 24.1 Introduction 723 24.2 Example: Handling an Attempt to Divide by Zero 724 24.3 When to Use Exception Handling 728 24.4 Rethrowing an Exception 729 24.5 Processing Unexpected Exceptions 731 24.6 Stack Unwinding 731 24.7 Constructors, Destructors and Exception Handling 732 24.8 Exceptions and Inheritance 733 24.9 Processing new Failures 733 24.10 Class unique_ptr and Dynamic Memory Allocation 735 24.11 Standard Library Exception Hierarchy 737 24.12 Wrap-Up 739 Appendix A Operator Precedence Chart 744 Appendix B ASCII Character Set 747 Appendix C Number Systems 748 Appendix D Game Programming: Solving Sudoku 759 Index 766 |