正在加载图片...
vi CONTENTS 8.1.3 Passing a two-dimensional array to a function .... 204 8.2 Character arrays··················· 209 8.2.1 One dimensional character arrays 209 8.2.2 Two dimensional character arrays . 211 8.3 Structures·················· 211 8.3.1 The structure definition..... 212 8.3.2 Where can structures be defined? 213 8.3.3 The members of a structure··.·· 213 8.3.4 Declaring structure variables..... 213 8.3.5 Assigning values to structure members 213 8.3.6 Re-assigning values of structure members... 214 8.3.7 Function call-by-value of a structure 214 8.3.8 Function call-by-reference to a structure... 215 8.3.9 Structure arrays...·················· 215 8.3.10 Example using structures and arrays:Ion transport.......... 218 8.4 Problems........······ 222 8.5 Projects..··. 228 9 Miscellaneous Topics 239 g.1 Generating random numbers.·.·····.···· 239 9.1.1 Example:Integrating functions by random sampling 246 9.2 Simple Sorting:The bubble or sinking sort....... 248 9.3 Recursion-A function calling itself ........ 249 9.4 Input and Output using files...··. 252 9.4.1 File and stream handling in C++..... 252 9.4.2 Creating sequential access files and writing to them.·,..·.··· 255 9.4.3 Reading from sequential access files 258 9.5 Command line arguments 261 9.6 Problems..·. 264vi CONTENTS 8.1.3 Passing a two-d imensional array to a function . . . . . . . . . . . . . 204 8.2 Character arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 8.2.1 One d imensional character arrays . . . . . . . . . . . . . . . . . . . . 209 8.2.2 Two d imensional character arrays . . . . . . . . . . . . . . . . . . . . 211 8.3 Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 8.3.1 The structure d efinition . . . . . . . . . . . . . . . . . . . . . . . . . 212 8.3.2 Where can structures be d efined ? . . . . . . . . . . . . . . . . . . . . 213 8.3.3 The members of a structure . . . . . . . . . . . . . . . . . . . . . . . 213 8.3.4 Declaring structure variables . . . . . . . . . . . . . . . . . . . . . . . 213 8.3.5 Assigning values to structure members . . . . . . . . . . . . . . . . . 213 8.3.6 Re-assigning values of structure members . . . . . . . . . . . . . . . . 214 8.3.7 Function call-by-value of a structure . . . . . . . . . . . . . . . . . . 214 8.3.8 Function call-by-reference to a structure . . . . . . . . . . . . . . . . 215 8.3.9 Structure arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 8.3.10 Example using structures and arrays: Ion transport . . . . . . . . . . 218 8.4 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 8.5 Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 9 Miscellaneous Topics 239 9.1 Generating rand om numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 9.1.1 Example: Integrating functions by rand om sampling . . . . . . . . . 246 9.2 Simple Sorting: The bubble or sinking sort . . . . . . . . . . . . . . . . . . . 248 9.3 Recursion—A function calling itself . . . . . . . . . . . . . . . . . . . . . . . 249 9.4 Input andOutput using files . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 9.4.1 File and stream hand ling in C++ . . . . . . . . . . . . . . . . . . . . 252 9.4.2 Creating sequential access files andwriting to them . . . . . . . . . . 255 9.4.3 Reading from sequential access files . . . . . . . . . . . . . . . . . . . 258 9.5 Command line arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 9.6 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有