正在加载图片...
iv CONTENTS 3.6 Sequencing,branching and looping 26 3.7 A mini-summary before the examples...···....···,.. 。。 27 3.8 Some examples.................·....·.·:.·.··· 27 3.8.1 The Breakfast algorithm,or,Bielajew's Sunday Morning Internationally- famous pancakes......... 28 3.8.2 Solve for x:Ax2+Bx+C=0 where A.B.C are arbitrary constants 29 3.8.3 Iteration:A summing loop.. 33 3.8.4 Iteration:A product loop 36 3.9 An aside on computer architecture 40 3.9.1 What does S=S+1 mean?. 40 3.10 Problems..... 3.11 Projects..·. 47 4 Getting started in C++ 49 4.1 Simple input/output (I/O):A first program in C++.... 49 4.2 Compiling,linking,loading and running 52 4.3 Declaring and initializing variables 55 4.4 Integer math in C++.·..··. 57 4.5 Floating point math in C++... 59 4.6 The if/else if/else construct... 60 4.7 Logical expressions.···· 63 4.7.1 Logical expressions with AND or OR 66 4.7.2 Mixed arithmetic and logical expressions 67 4.8 Problems.... 69 4.9 Projects·· 73 5 Loops 83 5.1 The while loop . 83 5.2 The do/while loop 86 5.3 The for loop 89iv CONTENTS 3.6 Sequencing, branching and looping . . . . . . . . . . . . . . . . . . . . . . . 26 3.7 A mini-summary before the examples . . . . . . . . . . . . . . . . . . . . . . 27 3.8 Some examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.8.1 The Breakfast algorithm, or, Bielajew’s Sunday Morning Internationally￾famous pancakes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 3.8.2 Solve for x: Ax2 + Bx + C = 0 where A, B, C are arbitrary constants 29 3.8.3 Iteration: A summing loop . . . . . . . . . . . . . . . . . . . . . . . . 33 3.8.4 Iteration: A prod uct loop . . . . . . . . . . . . . . . . . . . . . . . . 36 3.9 An asid e on computer architecture . . . . . . . . . . . . . . . . . . . . . . . 40 3.9.1 What does S = S + 1 mean? . . . . . . . . . . . . . . . . . . . . . . . 40 3.10 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 3.11 Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 4 Getting started in C++ 49 4.1 Simple input/output (I/O): A first program in C++ . . . . . . . . . . . . . . 49 4.2 Compiling, linking, loading and running . . . . . . . . . . . . . . . . . . . . 52 4.3 Declaring and initializing variables . . . . . . . . . . . . . . . . . . . . . . . 55 4.4 Integer math in C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 4.5 Floating point math in C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 4.6 The if/else if/else construct . . . . . . . . . . . . . . . . . . . . . . . . . 60 4.7 Logical expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 4.7.1 Logical expressions with AND or OR . . . . . . . . . . . . . . . . . . 66 4.7.2 Mixed arithmetic and logical expressions . . . . . . . . . . . . . . . . 67 4.8 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 4.9 Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 5 L oops 83 5.1 The while loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 5.2 The do/while loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 5.3 The for loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有