代碼規(guī)范試用ppt課件_第1頁
代碼規(guī)范試用ppt課件_第2頁
代碼規(guī)范試用ppt課件_第3頁
代碼規(guī)范試用ppt課件_第4頁
代碼規(guī)范試用ppt課件_第5頁
已閱讀5頁,還剩52頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、哈爾濱工業(yè)大學計算機科學與技術學院哈爾濱工業(yè)大學計算機科學與技術學院蘇小紅蘇小紅制作人 蘇小紅2制作人 蘇小紅3制作人 蘇小紅4制作人 蘇小紅5制作人 蘇小紅6制作人 蘇小紅7void void function(intfunction(int x) x) / / program code code void void function(intfunction(int x) x) / / program code code if (condition)if (condition) / / program code code elseelse / / program code code if (

2、condition)if (condition) / / program code code else else / / program code code for (initialization; condition; for (initialization; condition; update)update) / / program code code for (initialization; condition; for (initialization; condition; update)update) / / program code code while (condition)wh

3、ile (condition) / / program code code while (condition)while (condition) / / program code code 如果出現嵌套的,則使用縮進對齊如果出現嵌套的,則使用縮進對齊,如:,如: 制作人 蘇小紅8制作人 蘇小紅9制作人 蘇小紅10/ 空行空行void function1() / 空行空行void function2() / 空行空行void function3() / 空行空行while (condition)statement1;/ 空行空行if (condition) statement2;elsestat

4、ement3;/ 空行空行statement4; 制作人 蘇小紅11制作人 蘇小紅12void func1(int x, int y, int z); / 良好的風格良好的風格void func1 (int x,int y,int z); / 不良的風格不良的風格printf(%d%d%d, a, b, c); / 良好的風格良好的風格printf(%d%d%d,a,b,c); / 不良的風格不良的風格if (year = 2000) / 良好的風格良好的風格if(year=2000) / 不良的風格不良的風格if (a=b) & (c=b&c=d) / 不良的風格不良的風格f

5、or (i=0; i10; i+) / 良好的風格良好的風格for(i=0;i10;i+) / 不良的風格不良的風格for (i = 0; i 10; i +) / 過多的空格過多的空格x = a b ? a : b; / 良好的風格良好的風格x=afunction(); / 不要寫成不要寫成 b - function();制作人 蘇小紅13制作人 蘇小紅14intint width; width;/ / 寬度寬度intint height; height;/ / 高度高度intint depth; depth;/ / 深度深度intint width, height, depth; / wi

6、dth, height, depth; /寬度高度深度寬度高度深度x = a + b;x = a + b;y = c + d;y = c + d;z = e + f;z = e + f;x =x = a + b; y = c + d; z = e + f;a + b; y = c + d; z = e + f;if (width height) if (width height) dosomethingdosomething();(); if (width height) if (width height) dosomethingdosomething();();for (initializa

7、tion; condition; for (initialization; condition; update)update) dosomethingdosomething();(); / / 空行空行other();other();for (initialization; condition; update)for (initialization; condition; update) dosomethingdosomething();();other();other();制作人 蘇小紅15制作人 蘇小紅16制作人 蘇小紅17制作人 蘇小紅18制作人 蘇小紅19制作人 蘇小紅20制作人 蘇小紅21制作人 蘇小紅22制作人 蘇小紅23制作人 蘇小紅24制作人 蘇小紅25制作人 蘇小紅26制作人 蘇小紅27制作人 蘇小紅28制作人 蘇小紅29制作人 蘇小紅30制作人 蘇小紅31制作人 蘇小紅32制作人 蘇小紅33制作人 蘇小紅34制作人 蘇小紅35制作人 蘇小紅36制作人 蘇小紅37制作人 蘇小紅38制作人 蘇小紅39制作人 蘇小紅40制作人 蘇小紅41制作人 蘇小紅42制作人 蘇小紅43制作人 蘇

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論