freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

lesson1introduction-資料下載頁(yè)

2025-07-17 15:35本頁(yè)面
  

【正文】 on ? if( 0= x 10 ) ? if( (0=x) amp。amp。 (x 10) ) It will always be true. Why? 45 條件敘述 Condition Statements ? if … then … else … if(…){ … } else{ if(…){ … } else{ … } } if(…){ … } else if(…){ … } else{ … } if(…){ … } else if(…){ … } else{ … } else{ // Error! … } 46 重複性敘述 Iteration Statements ? 重複性敘述代表這種敘述句會(huì)重複執(zhí)行數(shù)次 ? C++有三種重複性敘述 ? while (expression){ … } ? do { … } while ( expression)。 ? for (sexpression。 expression。 nexpression) { … } ? 迴圈結(jié)束條件 looptermination criteria ? The rvalue of expression is false ? break ? continue ? The continue statement ignore the rest statements and passes control to the next iteration 47 重複性敘述 Iteration Statements ? Compare these three cases: int n = 0, s = 0。 scanf(%d, amp。n)。 while(n!=0){ s = s + n。 n = n – 1。 } printf(%d\n, s)。 int n = 0, s = 0。 scanf(%d, amp。n)。 do{ s = s + n。 n = n – 1。 } while(n != 0)。 printf(%d\n, s)。 int n = 0, s = 0。 int i = 0。 scanf(%d, amp。n)。 for(i=1。 i=n。 ++i) s = s + i。 printf(%d\n, s)。 48 Compiler’s Warnings amp。 Errors ? 警告訊息 Warning messages ? Warning不會(huì)中斷編譯工作 . ? Warning可以被忽略 . int x = 。 warning C4244: 39。=39。 : conversion from 39。double39。 to 39。int39。, ? 但是有些 Warning不可以被忽略 int x = 1。 unsigned int y = 0。 if( x y) printf(%d %d, x, y)。 warning C4018: 39。39。 : signed/unsigned mismatch 49 Compiler’s Warnings amp。 Errors ? 錯(cuò)誤訊息 error messages ? 錯(cuò)誤訊息會(huì)中斷編譯工作 . ? 錯(cuò)誤訊息你必須去解決它 . ? x = 1 + 1 // syntax error : missing 39。? ? if( x0){ x = 100。 // fatal error : without right brace ?}39。 50 Bugs ? What is a bug? ? 就是程式上的執(zhí)行錯(cuò)誤及瑕疵 ? 早期的計(jì)算機(jī)由於體積非常龐大,有些小蟲(chóng)子可能會(huì)鑽入機(jī)器內(nèi)部,造成計(jì)算機(jī)工作失靈。因此用「 Bug」來(lái)稱之。 ? 例如 : ? 文法上錯(cuò)誤 Lexical error ? 連結(jié)失敗 Linking failed ? 使用到位初始化的變數(shù) Uninitiated variable ? 除以零 Divided by zero ? 使用作業(yè)系統(tǒng)的資源造成的錯(cuò)誤 System error ? 邏輯上的錯(cuò)誤 Logical error Debugging in Dev C++ ? Breakpoint ? An stopping or pausing place in a program ? Set a breakpoint in Dev C++ ? Press Ctrl + F5 or by clicking in front of the line, outside of the editor window ? Debug mode ? Debug / Debug or press F8 ? Start to run your program ? Stop on the first breakpoint line. Notice that the breakpoint line not be executed yet. ? Continue to the next line: ? Debug / Next Step or press F7 ? Continue to the next breakpoint ? Debug / Continue or press Ctrl + F7 ? Stop the execution: ? Debug / Stop Execution or press Ctrl + Alt + F2 ? The code must be repiled if the code has been modified 51 Debugging in Dev C++ ? How to monitor the variables? ? Put the mouse icon on the variable for a while ? Or mark the variable, right click on it and click the Add Watch ? Or press F4 then type the name of the variable ? The value of the variable will be shown on the debug window, the left side of the code editor. 52 練習(xí)題 1. 臺(tái)灣有四種硬幣: 1元、 5元、 10元、 50元。請(qǐng) 寫(xiě)一個(gè) 程式,讓使用者可以輸入一個(gè)正整數(shù),並算出最佳的硬幣組合。 ? 例:輸入 136,則 會(huì)算 出 1個(gè) 1元 、 1個(gè) 5元 、 3個(gè) 10元 、 2個(gè) 50元 2. 請(qǐng)寫(xiě)一個(gè)程式,讓使用者可以輸入 一個(gè)十進(jìn)位正整數(shù), 並加總所有位數(shù) (digit)。 ? 本題禁止用字串處理方式,輸入數(shù)字部分只能用 scanf(%d, amp。n)。 ? 例 :輸入 8051, 則 會(huì)顯示 8+0+5+1 = 14 3. 費(fèi)伯納西數(shù)列 (Fibonacci number) ? F0 = 1, F1 = 1 ? Fn = Fn1 + Fn2 if n 1 ? 請(qǐng) 寫(xiě)一個(gè)程式,讓使用者可以輸入一個(gè)正 整數(shù) n。再個(gè)別以 while , do…while , 及 for loop這三種重複性敘述來(lái)產(chǎn)生 F0~Fn的費(fèi) 伯納西 數(shù) ? 例 :輸入 12, 則會(huì) 顯示三次下列結(jié)果 (用三種不同 的 重複 性 敘述 ) 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144 53
點(diǎn)擊復(fù)制文檔內(nèi)容
化學(xué)相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1