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

正文內(nèi)容

編程的調(diào)試技巧(存儲版)

2025-09-06 11:18上一頁面

下一頁面
  

【正文】 (n%10==0) coutendl。 for(i=2。 return 0。i=k。 } 求 100200間的素數(shù) 正確寫法 include include int main () { int a=10。)39。\t39。 } return 0。++m) cout*flush。++n) cout*flush。)39。 ? 解決辦法:在命令提示符下執(zhí)行程序,使用輸出重定向功能,然后去相關(guān)目錄下查看輸出文件。 coutendl。 coutendl。k++) cout39。*39。 } return 0。 coutsetw(i)setfill(39。 for(int n=1。++i) { for(int m=1。*39。 39。 coutsetw(ai)setfill(39。 } coutendlthe total number is: nendl。 k=int(sqrt(m))。 } if(n%10==0) coutendl。m=199。 } if(prime) { coutsetw(5)m。 bool prime=1。 int m = n * Factorial ( n 1 )。 return m。 else return n * Factorial ( n 1 ) 。 } coutendl。p=10z。n=11s。 } coutendl。 } coutendl。 } 調(diào)試后的程序,改正了循環(huán)中的邏輯問題,另外,本程序存在變量定義過多的缺點 include void main() { for(int i=1。flush。 coutendl。m++) cout39。k++) cout39。*39。*39。z=10。 39。*39。flush。 coutendl。z++) { for(int p=9。 for(int n=10。 coutendl。 coutendl。 } coutendl。p=10z。n=11s。 } coutendl。 } coutendl。 } 求階乘 結(jié) 論 5 ? 通過單步執(zhí)行可以發(fā)現(xiàn)程序運行的軌跡 ? 通過單步執(zhí)行可以隨時監(jiān)視變量的值,無論何時發(fā)現(xiàn)變量值與我們的預(yù)期不一致時,即找到了錯誤點 單步調(diào)試方法 ? 前提: debug版本可執(zhí)行程序, build正確 ? 進入調(diào)試狀態(tài) ? F10為單步調(diào)試,要深入到子函數(shù)中單步調(diào)試,應(yīng)在函數(shù)調(diào)用語句處按 F11 ? 單步調(diào)試應(yīng)該結(jié)合 watch窗口監(jiān)視變量值的變化 稍復(fù)雜的例子 include void main() { for(int i=1。 cout請輸入一個正整數(shù) :endl。 cout請輸入一個正整數(shù) :endl。 cout請輸入一個正整數(shù) :endl。 type = 122) cout輸入的字符為小寫字母 !endl。!39。 if(type = 48 amp。) { cout請輸入一個字符: endl。/39。39。 //這段代碼執(zhí)行不到 f=integer1integer2。 char op,a。:coutg。:coute。 coutinteger2 is:。 include void main() { double integer1,integer2,e,f,g,h。b==c) { coutdengbian sanjiaoxing\n。 else 。y39。:oute=num1num2。:oute=num1/num2。 coutenter its operater:endl。 /*display decimal number in LCD */ LCD__putchar(39。 /* define and initialize variable for string length*/ /* refer every character in onedimensional array buff pointed by */ /* pointer str, count up until detect (39。 } return 0。 static void get_string(unsigned char *message, unsigned char *buff)。 d=i。 Release:沒有調(diào)試信息,不能調(diào)試,文件小 切換 Debug模式和Release模式 比較文件大小 編譯( ctrl+F7):編譯源文件到目標(biāo)文件 構(gòu)建( F7):鏈接目標(biāo)文件和庫函數(shù)為可執(zhí)行文件,如無目標(biāo)文件則先生成 清潔:刪掉 debug或者 release版本的所有中間文件和可執(zhí)行文件 調(diào)試 單步執(zhí)行( F10):單步執(zhí)行,遇到函數(shù)調(diào)用時把其當(dāng)作一條語句執(zhí)行 深入函數(shù)的單步執(zhí)行( F11):單步執(zhí)行,遇到函數(shù)調(diào)用是深入到其內(nèi)部 執(zhí)行到光標(biāo)處( ctrl+F10):一次執(zhí)行完光標(biāo)前的所有語句,并停到光標(biāo)處 跳出( shift+F11):執(zhí)行完當(dāng)前函數(shù)的所有剩余代碼,并從函數(shù)跳出 重新開始調(diào)試( ctrl+shift+F5):重新開始調(diào)試過程 結(jié)束調(diào)試( shift+F5):執(zhí)行完程序的剩余部分,結(jié)束調(diào)試 設(shè)置 /取消斷點( F9):在某一行設(shè)置和取消斷點 當(dāng)前執(zhí)行的語句 堆棧的內(nèi)容:函數(shù)調(diào)用關(guān)系 從這里可以 查看內(nèi)存數(shù)據(jù) 程序執(zhí)行過程中的一 些變量會顯示在這里 著名的 watch窗口:看變量 表達式、地址等各種信息 寄存器當(dāng)前值 二、調(diào)試方法 樹立正確的編程方法論 ? 沒有解決不了的問題,樹立編程信心 ? 按照正確的方法來編程 –從實踐中體會解決問題的思路、編程的思想 –熟練掌握語法,數(shù)據(jù)結(jié)構(gòu),算法、模式,底層環(huán)境 –按照編程規(guī)范來編寫代碼 –充分利用各種資源: ?調(diào)試器 ? msdn ?網(wǎng)絡(luò)搜索引擎 常用調(diào)試手段 1. 利用編譯器的輸出信息排除錯誤 2. 利用調(diào)試器的調(diào)試功能 單步、 run to cursor、斷點、條件斷點、查看堆棧、 利用 watch窗口查看變量、表達式的值 3. 分段調(diào)試法、增量調(diào)試法 4. 利用 flush人為刷新緩沖區(qū) 5. 修改輸出信息,增加標(biāo)志位 6. 利用輸出語句打印調(diào)試信息 7. 通過堆棧觀察函數(shù)調(diào)用情況 8. 綜合程序調(diào)試方法 9. 注釋的技巧、條件編譯 幾個簡單例子 include include void main() { coutsetw(10)十進制 setw(10)二進制 setw(10)八進制“ setw(10)十六進制 endl。j/=2){if(d/j==1) cout1。 /* display decimal number in LCD */ /*FUNC COMMENT************************************************************* * ID : * function name : main * function : call function to get string length, display result * parameter : none * return : result 0:normal end * function used : get_strlength * notice : none * History
點擊復(fù)制文檔內(nèi)容
醫(yī)療健康相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1