《雙語版C++程式設計(Learn C++ through English and Chinese)》是2010年6月電子工業出版社出版的圖書,作者是[愛] Paul Kelly(保羅 凱利)。
基本介紹
- 中文名:雙語版C++程式設計(Learn C++ through English and Chinese)
- 作者:[愛] Paul Kelly(保羅 凱利)
- 出版時間:2010年6月
- 出版社:電子工業出版社
- 頁數:404 頁
- ISBN:9787121107979
- 定價:45 元
- 開本:16 開
內容簡介,圖書目錄,
內容簡介
本書由在電腦程式設計方面有著豐富教學和實踐經驗的中外作者合作編寫。共分14章內容,由淺入深全面介紹C++程式設計方法。本書通俗易懂,例子貼近生活,尤其強調讀者的親自參與意識。所有實例經過精心挑選。每章都為初學者提供了常見錯誤分析,每章結尾有很多有趣的習題,可以提高讀者上機編程的興趣。
本書是國內首次出版的中英文對照混排式雙語版C++程式設計教材,既方便初學者熟悉相關概念和內容,也便於英文非母語的讀者熟悉英文專業辭彙。
本書可作為高等學校計算機相關專業或軟體學院的C++程式設計雙語教材,也可供程式設計師和編程愛好者參考使用。
圖書目錄
Chapter One Introduction(緒論) 1
1.1 What is a computer program? (什麼是電腦程式?)1
1.2 Developing a computer program(開發電腦程式) 2
1.2.1 Program development cycle 2
1.3 Learning C++(學習 C++) 4
1.4 Web site for this book(本書的網站) 5
1.5 Brief history of C++(C++簡史) 5
1.6 ANSI/ISO C++ standard(ANSI/ISO C++標準) 5
Chapter Two Beginning to Program in C++(C++編程入門)6
2.1 Constants(常量) 6
2.2 Variables(變數) 6
2.3 Simple output to the screen(簡單的螢幕輸出) 7
2.4 Comments(注釋) 9
2.5 Data types(數據類型) 11
2.5.1 Short Integer data types 11
2.5.2 Long Integer data types 11
2.5.3 Boolean data types 11
2.5.4 Double Floating-point data types 11
2.6 Data type sizes(數據類型的大小) 12
2.7 Operators(運算符) 12
2.7.1 The assignment operator12
2.7.2 Arithmetic operators 13
2.7.3 Increment and decrement operators 14
2.7.4 Combined assignment operators 17
2.8 Operator precedence(運算符的優先權) 17
2.9 Type conversions and casts(類型轉換和強轉) 19
Programming pitfalls 22
Quick syntax reference 24
Exercises 25
Chapter Three Keyboard Input and Screen Output(鍵盤輸入和螢幕輸出) 29
3.1 Simple keyboard input(簡單的鍵盤輸入) 29
3.2 Manipulators(流操縱符) 31
3.3 Single-character input and output(單個字元的輸入和輸出) 34
Programming pitfalls 36
Quick syntax reference 36
Exercises 37
Chapter Four Selection and Iteration(選擇與循環) 38
4.1 Selection(選擇) 38
4.1.1 The if statement38
4.1.2 The if-else statement 39
4.1.3 Compound statements 40
4.1.4 Logical operators 41
4.1.5 Nested if statements 42
4.1.6 The switch statement 42
4.1.7 The conditional operator ?:44
4.2 Iteration(循環) 45
4.2.1 The while statement 45
4.2.2 The do-while loop 47
4.2.3 The for statement 48
4.2.4 Nested loops 50
Programming pitfalls 53
Quick syntax reference 55
Exercises 57
Chapter Five Arrays and Structures(數組和結構體) 60
5.1 Arrays(數組) 60
5.1.1 Introduction 60
5.1.2 Initialising an array 64
5.1.3 Two-dimensional arrays 65
5.1.4 Initialising a two-dimensional array 67
5.1.5 Multi-dimensional arrays 68
5.2 Structures(結構體) 69
5.2.1 Introduction 69
5.2.2 Declaring a structure 69
5.2.3 Initialising a structure variable 72
5.2.4 Nested structures 73
5.3 The typedef statement(typedef語句) 74
5.4 Arrays of structures(結構體數組) 75
5.5 Enumerated data types(枚舉數據類型) 75
Programming pitfalls 77
Quick syntax reference 78
Exercises 78
Chapter Six Strings(字元串) 82
6.1 C-strings(C風格字元串) 82
6.2 C-string input and output(C風格字元串的輸入和輸出) 83
6.3 Accessing individual characters of a C-string(訪問C風格字元串中的單個字元) 88
6.4 C-string functions(C風格字元串函式) 88
6.4.1 Finding the length of a C-string 89
6.4.2 Copying a C-string 89
6.4.3 C-string concatenation 90
6.4.4 Comparing C-strings 90
6.4.5 Other C-string functions 91
6.4.6 Converting numeric C-strings to numbers 91
6.5 C++ strings(C++字元串) 92
6.5.1 string initialisation and assignment 94
6.5.2 string concatenation 96
6.5.3 string length, string indexing and sub-
strings 97
6.5.4 string replace, erase, insert and empty
strings 99
6.5.5 string searching 100
6.5.6 string comparisons 102
6.5.7 string input104
6.5.8 string conversions 105
6.6 Arrays of strings(string類型的數組) 107
6.7 Character classification(字元分類) 107
Programming Pitfalls 110
Quick Syntax Reference 111
Exercises 111
Chapter Seven Functions(函式) 114
7.1 Introduction(引言) 114
7.2 Function arguments(函式實參) 116
7.3 Default parameter values(默認的形參值) 120
7.4 Returning a value from a function(從函式返回一個值) 120
7.5 Inline functions(內聯函式) 122
7.6 Passing arguments by value(按值傳遞實參) 123
7.7 Passing arguments by reference(按引用傳遞實參)124
7.8 Passing a one-dimensional array to a function(向函式傳遞一維數組) 127
7.9 Passing a multi-dimensional array to a function(向函式傳遞多維數組) 132
7.10 Passing a structure variable to a function(向函式傳遞結構體變數) 133
7.11 Passing a string to function(向函式傳遞字元串)136
7.11.1 Passing a C++ string to a function 136
7.11.2 Passing a C-string to a function 137
7.12 Recursion(遞歸) 137
7.13 Function overloading(函式重載) 140
7.14 Storage classes auto and static(auto和static存儲類型) 142
7.14.1 auto142
7.14.2 static142
7.15 The scope of a variable(變數的作用域) 144
7.15.1 Block scope 144
7.15.2 Global scope 145
7.15.3 Reusing a variable name 146
7.16 Mathematical functions(數學函式) 148
7.16.1 Some trigonometric functions 148
7.16.2 Pseudo-random number functions 149
Programming Pitfalls 151
Quick Syntax Reference 151
Exercises 152
Chapter Eight Objects and Classes(對象和類) 157
8.1 What is an object? (什麼是對象?) 157
8.2 What is a class? (什麼是類?) 157
8.3 Further examples of classes and objects(類和對象的更進一步的示例) 160
8.3.1 A student class 160
8.3.2 A bank account class 161
8.4 Abstraction(抽象) 162
8.5 Constructing a class in C++(在C++中構造一個類) 162
8.6 Using a class: defining and using objects(使用類:定義和使用對象) 165
8.7 Abstract data types(抽象數據類型) 166
8.8 Constructors(構造函式) 167
8.9 Default class constructor(默認的類構造函式) 169
8.10 Overloading class constructors(重載類構造函式)172
8.11 Constructor initialisation lists(構造函式初始化列表) 174
8.12 Default argument values in a constructor(構造函式中的默認實參值) 174
8.13 static class data members(靜態類數據成員) 176
8.14 Using return in a member function(在成員函式中使用return) 180
8.15 Inline class member functions(內聯成員函式) 182
8.16 Class interface and class implementation(類的接口和類的實現) 183
8.16.1 Separation of class interface and class
implementation 185
8.16.2 Use of namespaces in header files 187
Programming Pitfalls 191
Quick Syntax Reference 191
Exercises 192
Chapter Nine Pointers and Dynamic Memory(指針和動態記憶體分配) 196
9.1 Variable addresses(變數的地址) 196
9.2 Pointer variables(指針變數) 197
9.3 The dereference operator *(解引用運算符*) 198
9.4 Using const with pointers(使用const修飾指針變數)
199
9.5 Pointers and one-dimensional arrays(指針和一維數組) 201
9.6 Pointers and multi-dimensional arrays(指針和多維數組) 203
9.7 Pointers to structures(指向結構體的指針) 204
9.8 Pointers to class objects(指向類對象的指針) 206
9.9 Pointers as function arguments(指針變數作為函式實參) 207
9.10 Dynamic memory allocation(動態記憶體分配) 209
9.10.1 Allocating memory dynamically for an array 210
9.10.2 Initialisation with new211
9.10.3 Allocating memory for multi-dimensional
arrays 213
9.10.4 Out of memory error 215
Programming pitfalls 217
Quick syntax reference 218
Exercises 219
Chapter Ten Operator Overloading(運算符重載) 222
10.1 The need for operator overloading(運算符重載的必要性) 222
10.2 Overloading the addition operator +(重載加法運算符+) 223
10.3 Rules of operator overloading(運算符重載的規則) 230
10.4 Overloading ++(重載運算符++) 231
10.4.1 Overloading prefix and postfix forms of ++ 233
10.4.2 Improving the prefix ++ operator member function 237
10.5 Overloading relational operators(重載關係運算符) 237
10.6 Overloading > (重載運算符)