定 價(jià):59 元
叢書名:清華大學(xué)計(jì)算機(jī)系列教材
- 作者:鄭莉,楊芳,董淵編著
- 出版時(shí)間:2015/6/1
- ISBN:9787302374848
- 出 版 社:清華大學(xué)出版社
- 中圖法分類:TP312C
- 頁碼:434
- 紙張:膠版紙
- 版次:1
- 開本:16K
本書主要內(nèi)容包括:程序設(shè)計(jì)基礎(chǔ)知識(shí)、類與對(duì)象的基本概念、繼承與多態(tài)、輸入輸出流以及泛型程序設(shè)計(jì)等。
Chapter 1Introduction1
1.1The Development of Computer Programming Language1
1.1.1Machine Language and Assembly Language1
1.1.2Highlevel Language2
1.1.3Objectoriented Language2
1.2Objectoriented Method3
1.2.1The Origin of Objectoriented Method3
1.2.2Basic Concepts of Objectoriented 5
1.3Objectoriented Software Development6
1.3.1Analysis7
1.3.2Design7
1.3.3Programming7
1.3.4Test7
1.3.5Maintenance8
1.4Representation and Storage of Information8
1.4.1Digital System of Computer8
1.4.2Conversions among Numeral Systems10
1.4.3Storage Units of Information13
1.4.4Binarycoded Representation13
1.4.5Fixed Point Number and Floating Point Number17
1.4.6The Number Range That Can Be Represented18
1.4.7Representation of Nonnumerical Information19
1.5The Development Process of Programs 20
1.5.1Elementary Terms20
1.5.2The Development Process20
Summary21
Exercises22
Chapter 2Elementary C++ Programming23
2.1An Overview of C++Language23
2.1.1Origins of C++23
2.1.2Characteristics of C++24
2.1.3C++Programming Examples24
2.1.4Character Set26
2.1.5Lexical Tokens26
2.2Basic Data Types and Expressions28
2.2.1Basic Data Types29
2.2.2Constants30
2.2.3Variables32
2.2.4Symbol Constants33
2.2.5Operators and Expressions34
2.2.6Statement43
2.3Data Input and Output44
2.3.1I/O Stream44
2.3.2Predefined Input and Output Operator44
2.3.3Simple I/O Format Control45
2.4The Fundamental Control Structures of Algorithms46
2.4.1Achieving Case Structure Using if Statement47
2.4.2Multiple Selection Structure48
2.4.3Loop Structure51
2.4.4Nestings of Loop Structure and Case Structure57
2.4.5Other Control Statements59
2.5UserDefined Data Type60
2.5.1typedef Declaration60
2.5.2Enumeration Type—enum60
2.5.3Structure62
2.5.4Union65
Summary67
Exercises68
Chapter 3 Functions72
3.1Definition and Use of Function72
3.1.1Definition of Function72
3.1.2Function Calls73
3.1.3Passing Parameters between Functions86
3.2Inline Functions90
3.3Default Formal Parameters in Functions92
3.4Function Overloading94
3.5Using C++ System Functions97
Summary99
Exercises100
Chapter 4Class and Object102
4.1Basic Features of ObjectOriented Design102
4.1.1Abstraction102
4.1.2Encapsulation103
4.1.3Inheritance104
4.1.4Polymorphism104
4.2Class and Object105
4.2.1Definition of Class 106
4.2.2Access Control to Class Members107
4.2.3Member Function of Class108
4.2.4Object110
4.2.5Program Instance111
4.3Constructor and Destructor112
4.3.1Class Constructor112
4.3.2The Copy Constructor115
4.3.3Class Destructor119
4.3.4Program Instance120
4.4Combination of Classes121
4.4.1Combination122
4.4.2Forward Declaration126
4.5UML128
4.5.1Brief Introduction of UML128
4.5.2UML Class Diagrams129
4.6Program Instance—Personnel Information Management Program135
4.6.1Design of Class135
4.6.2Source Code and Description136
4.6.3Running Result and Analyses138
Summary138
Exercises139
Chapter 5Data Sharing and Protecting141
5.1Scope and Visibility of Identifiers141
5.1.1Scope141
5.1.2Visibility143
5.2Lifetime of Object144
5.2.1Static Lifetime144
5.2.2Dynamic Lifetime144
5.3Static Members of Class147
5.3.1Static Data Member148
5.3.2Static Function Member150
5.4Friend of Class152
5.4.1Friend Function154
5.4.2Friend Class156
5.5Protection of Shared Data157
5.5.1Constant Reference157
5.5.2Constant Object158
5.5.3Class Members Modified by const159
5.6Multifile Structure and Compilation Preprocessing Directives161
5.6.1General Organization Structure of C++Program161
5.6.2External Variable and External Function164
5.6.3Standard C++Library and Namespace165
5.6.4Compilation Preprocessing166
5.7Example—Personnel Information Management Program170
Summary174
Exercises174
Chapter 6Arrays, Pointers and Strings176
6.1Arrays176
6.1.1Declaration and Use of Arrays177
6.1.2Storage and Initialization of Arrays179
6.1.3Using Arrays as Function Parameters181
6.1.4Object Arrays183
6.1.5Program Examples185
6.2Pointers189
6.2.1Access Method of Memory Space189
6.2.2Declaration of Pointer Variables190
6.2.3Operations Related to Addresses—‘’ and ‘a(chǎn)nd’191
6.2.4Assignment of Pointers192
6.2.5Pointer Operations195
6.2.6Using Pointers to Process Array Elements196
6.2.7Pointer Arrays198
6.2.8Using Pointers as Function Parameters200
6.2.9Functions of Pointer Type202
6.2.10Pointers that Point to Functions203
6.2.11Object Pointers205
6.3Dynamic Memory Allocation211
6.3.1new Operation and delete Operation211
6.3.2Dynamic Memory Allocation and Release Functions216
6.4Deep Copy and Shallow Copy216
6.5Strings220
6.5.1Using Character Arrays to Store and Process Strings221
6.5.2The string Class223
6.6Program Example—Personnel Information Management Program226
Summary230
Exercises231
Chapter 7Inheritance and Derivation234
7.1Inheritance and Derivation of Class234
7.1.1Instances of Inheritance and Derivation234
7.1.2Definition of Derived Class236
7.1.3The Generation Process of Derived Class238
7.2Access Control240
7.2.1Public Inheritance240
7.2.2Private Inheritance 243
7.2.3Protected Inheritance245
7.3Type Compatible Rule 247
7.4Constructor and Destructor of Derived Class250
7.4.1Constructor251
7.4.2Copy Constructor254
7.4.3Destructor255
7.5Identification and Access of DerivedClass Member257
7.5.1Scope Resolution257
7.5.2Virtual Base Class263
7.5.3Constructors of Virtual Base Class and Derived Class266
7.6Program Example: Solving Linear Equations by Gaussian Elimination
Method267
7.6.1Fundamental Principles 268
7.6.2Analysis of the Program Design269
7.6.3Source Code and Explanation269
7.6.4Execution Result and Analysis275
7.7Program Example: Personnel Information Management Program276
7.7.1Problem Description 276
7.7.2Class Design276
7.7.3Source Code and Explanation276
7.7.4Running Result and Analysis282
Summary283
Exercises284
Chapter 8Polymorphism286
8.1An Overview of polymorphism286
8.1.1Types of Polymorphism286
8.1.2Implementation of Polymorphism287
8.2Operator Overload287
8.2.1Rules of Operator Overload288
8.2.2Operator Overloaded as Member Function289
8.2.3Operator Overloaded as Friend Function294
8.3Virtual Function296
8.3.1Ordinary Virtual Function Member297
8.3.2Virtual Destructor300
8.4Abstract Class301
8.4.1Pure Virtual Function302
8.4.2Abstract Class302
8.5Program Instance: Variable Stepwise Trapezoid Method to Calculate
Functional Definite Integral304
8.5.1Basic Principle 304
8.5.2Analysis of Program Design306
8.5.3Source Code and Explanation307
8.5.4Execution Result and Analysis310
8.6Program Instance: Improvement to Staff Information Management
System in a Small Corporation310
Summary316
Exercises317
Chapter 9Collections and Their Organization319
9.1Function Template and Class Template320
9.1.1Function Template320
9.1.2Class Template323
9.2Linear Collection326
9.2.1Definition of Linear Collection326
9.2.2Direct Accessible Linear Collection—Array328
9.2.3Sequential Access Collection—Linked List337
9.2.4Stack343
9.2.5Queues349
9.3Organizing Data in Linear Collection352
9.3.1Insertion Sort352
9.3.2Selection Sort353
9.3.3Exchange Sort355
9.3.4Sequential Search 356
9.3.5Binary Search357
9.4Application—Improving the HR Management Program of a Small
Company358
Summary359
Exercises360
Chapter 10Generic Programming and STL362
10.1Generic Programming362
10.1.1Introduction362
10.1.2Namespace363
10.1.3Differences of Naming Conventions between C/C++364
10.1.4Concepts of STL365
10.2Containers in STL367
10.2.1Sequential Container367
10.2.2Adapters of Containers375
10.3Iterators377
10.3.1Types of Iterators378
10.3.2Auxiliary Functions in Iterators379
10.4Algorithms in STL381
10.4.1Using the Algorithms381
10.4.2NonMutating Sequence Algorithms383
10.4.3Mutating Sequence Algorithms385
10.4.4Sorting Related Algorithms389
10.4.5Numerical Algorithms393
10.5Function Objects394
10.6Application—Improving the HR Management
Program of a Small Company397
Summary399
Exercises399
Chapter 11The I/O Stream Library and Input/Output401
11.1I/O Streams Concept and the Structure of Stream Library401
11.2Output Stream404
11.2.1Construct Output Object404
11.2.2The Use of Inserter and Manipulator405
11.2.3Output File Stream Member Function409
11.2.4Binary Output File412
11.3Input Stream413
11.3.1Construct Input Stream Object413
11.3.2Extraction Operator414
11.3.3Input Stream Manipulator414
11.3.4Input Stream Member Function414
11.4Input/Output Stream418
11.5Example—Improve Employee Information Management System418
Summary421
Exercises421
Chapter 12Exception Handling423
12.1Basic Concepts of Exception Handling423
12.2The Implementation of Exception Handling in C++424
12.2.1The Syntax of Exception Handling424
12.2.2Exception Interface Declaration427
12.3Destruction and Construction in Exception Handling427
12.4Exception Handling of Standard Library430
12.5Program Example—Improvement to Personal Information Administration
Program in a Small Company431
Summary433
Exercises433