正在加载图片...
CONTENTS 5.4 Problems....... 94 5.5 Projects······· 111 6 Early Abstraction-Functions 123 6.1 Motivation for functions.... 123 6.2 User-defined functions........... 129 6.3 Example:A problem tackled with teamwork.... 134 6.4 Call by value,call by reference,reference parameters 138 6.4.1 The address of a variable..... 138 6.4.2 Call-by-value us.call-by-reference 140 6.5 The rules of scope..... 145 6.6 Problems.····. 153 6.7 Projects······ 160 7 More Variable Types,Data Abstraction 167 7.1 Representation of floating-point numbers ... 167 7.1.1 When is one not one?Floating point anomalies. 174 7.2char:the character variable...:·.·· 175 7.2.1 Character strings;the string class 177 7.3 The vector class..·...·..· 179 7.3.1 Introduction to vectors... 179 7.3.2 Declaring and using vectors 180 7.3.3 Vector syntax and rules:... 182 7.3.4 Vectors and functions.. 187 7.4 Problems........·. 189 8 More Data Abstraction,Arrays,Structures 199 8.1 Arrays·············· 199 8.1.1 Declaring a 2-dimensional array 200 8.1.2 Initializing a 2-dimensional array.... 201CONTENTS v 5.4 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 5.5 Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 6 Early Abstraction—Functions 123 6.1 Motivation for functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 6.2 User-d efined functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 6.3 Example: A problem tackled with teamwork . . . . . . . . . . . . . . . . . . 134 6.4 Call by value, call by reference, reference parameters . . . . . . . . . . . . . 138 6.4.1 The ad d ress of a variable . . . . . . . . . . . . . . . . . . . . . . . . . 138 6.4.2 Call-by-value vs. call-by-reference . . . . . . . . . . . . . . . . . . . . 140 6.5 The rules of scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 6.6 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 6.7 Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 7 More Variable Types, Data Abstraction 167 7.1 Representation of floating-point numbers . . . . . . . . . . . . . . . . . . . . 167 7.1.1 When is one not one? Floating point anomalies. . . . . . . . . . . . . 174 7.2 char: the character variable . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 7.2.1 Character strings; the string class . . . . . . . . . . . . . . . . . . . . 177 7.3 The vector class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 7.3.1 Introd uction to vectors . . . . . . . . . . . . . . . . . . . . . . . . . . 179 7.3.2 Declaring and using vectors . . . . . . . . . . . . . . . . . . . . . . . 180 7.3.3 Vector syntax and rules: . . . . . . . . . . . . . . . . . . . . . . . . . 182 7.3.4 Vectors and functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 7.4 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 8 More Data Abstraction, Arrays, Structures 199 8.1 Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 8.1.1 Declaring a 2-d imensional array . . . . . . . . . . . . . . . . . . . . . 200 8.1.2 Initializing a 2-d imensional array . . . . . . . . . . . . . . . . . . . . 201
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有