




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、精選安徽工業大學軟件工程實驗報告 PAGE 26 ?軟件工程?實驗報告 姓 名:江文杰 學 號:139074333 班 級:網133 指導老師:周兵 實驗目的1能按照軟件工程的思想,采用面向過程的方法開發出一個小型軟件系統。2在軟件系統開發過程中,能綜合利用一門編程語言和軟件工程等多門課程的知識。 3培養良好的軟件開發習慣,了解軟件企業文化。 4掌握結構化數據流分析技術。 5掌握結構化程序設計的根本概念與技術,并且養成良好的編碼風格。 6掌握單元測試的一般步驟及技術。 7掌握集成測試的一般步驟和技術。實驗內容軟件需求分析 、功能需求分析輸入一個年份1-3000,然后顯示12個月的月歷能解決閏年
2、和平年問題能輸出顯示結果、運行需求分析 操作系統: Windows9x, Windows2000, Windows XP及更高版本、數據流圖是否閏年確定年份開始信息開始信息年份顯示其他月份顯示12月錯誤顯示表頭計算1月1日檢查輸入年份任意鍵年份年份非法顯示2月顯示1月 軟件結構圖:mainsetinit()output()inputyear()checkinput()setinfo()printmonth()printhead()isleap ()軟件設計與編碼#include #include #include #include #define firstdayof1 1 /* 定義第一年的
3、第一天, 星期日=7 */#define gap /* set gap between numbers of dates */#define dent /* set right margin. */struct info int month; int firstdayofmonth; int daysofmonth; int leap; monthinfo; int checkinput(void);int inputyear(void);int isleap(int y);void output(struct info);void printhead(struct info );void p
4、rintmonth(struct info);struct info setinit(int);struct info setmonthinfo(struct info );/* 這個作用是判斷年, 如果是閏年, return 1, 否那么 return 0 */ int isleap(int y) return (y%4=0 & y%100!=0) | y%400=0);/* This module is to accept inputyear() and check if it is correct. if it is correct it return int year, otherwi
5、se ask user reenter */ int checkinput(void) int y; do y=inputyear(); if(y3000) printf(n輸入錯誤!。nn); y=0; while(y1); return y; /* This function is to accept the input year, if it is the integer, it returns it, otherwise it return -1 */int inputyear(void) char s80; int i, y; y=-1; printf(請輸入年份(1-3000):)
6、; for(i=0;i80;+i) si=getchar(); if(si=27) exit(0); if(si=10) break; for(i=0;i80;+i) if(si=10) break; else if(!isdigit(si) return y; y=atoi(s); return y;/*This module is to accept monthinfo, and print the whole year calender. */void output(struct info monthinfo) char ch; do printhead(monthinfo); prin
7、tmonth(monthinfo); printf(按任意鍵顯視下一月, 按Esc鍵退出. n); ch=getchar(); if(ch=27) exit(0); monthinfo=setmonthinfo(monthinfo); while(monthinfo.month13);/* This module is to accept monthinfo, amd print monthly head like一 月 */void printhead(struct info monthinfo) char *ss; printf(%s,dent); switch(monthinfo.mon
8、th) case 1: ss=一 月; break; case 2: ss=二 月; break; case 3: ss=三 月; break; case 4: ss=四 月; break; case 5: ss=五 月; break; case 6: ss=六 月; break; case 7: ss=七 月; break; case 8: ss=八 月; break; case 9: ss=九 月; break; case 10: ss=十 月; break; case 11: ss=十一 月; break; case 12: ss=十二 月; printf( %s%s%s%snn,gap
9、,gap,gap,ss);/* This module is to accept monthinfo, and print the numbered dates of the month. */void printmonth(struct info monthinfo) int i,j,k; printf(%s,dent); printf(一%s二%s三%s四%s五%s六%s日nn,gap,gap,gap,gap,gap,gap); printf(%s,dent); for(i=1;imonthinfo.firstdayofmonth;i=i+1) printf(%s ,gap); k=mon
10、thinfo.firstdayofmonth; for(j=1;j7) k=k-7; printf(nn%s,dent); ; k=k+1; printf(%2d%s,j,gap); printf(nn);/* This module is to accept the monthinfo, and set the monthinfo of next month. */ struct info setmonthinfo(struct info monthinfo) int m; monthinfo.firstdayofmonth= (monthinfo.firstdayofmonth+ mont
11、hinfo.daysofmonth-1)%7+1; monthinfo.month=monthinfo.month+1; monthinfo.daysofmonth=30; m=monthinfo.month; if(m=1 | m=3 | m=5 | m=7 | m=8 | m=10 | m =12) monthinfo.daysofmonth=31; if(m=2) if(monthinfo.leap) monthinfo.daysofmonth = 29; else monthinfo.daysofmonth = 28; return monthinfo;/* This module i
12、s to initialize the monthinfo. */struct info setinit(int year) int i,days,total; struct info monthinfo; monthinfo.month=1; monthinfo.firstdayofmonth=firstdayof1; for(i=1;iyear;i=i+1) if(isleap(i) days=366; else days=365 ; monthinfo.firstdayofmonth=(monthinfo.firstdayofmonth+days-1)%7+1; monthinfo.da
13、ysofmonth=31; monthinfo.leap=isleap(year); return monthinfo; void main()printf( tt* n);printf( tt歡送使用萬年歷演示程序 n);printf( tt* n); int year ; struct info monthinfo; year = checkinput(); monthinfo = setinit(year); output(monthinfo);單元測試白盒測試黑盒測試2023年三月四月五月六月2023年:總結和體會本次用C語言編寫的萬年歷系統主要實現了年歷、月歷、日歷的顯示。我根本就不
14、喜歡敲代碼了,看見代碼就頭疼。所以感覺厭惡這門專業,對學習也不感興趣了。而且,還有一件更頭疼的事是在寫一個簡單的程序時竟然老是出錯,難一點的,復雜一點的程序竟然無從下手。但是去看程序的參考答案時都看得懂,又感覺很容易。學了軟件工程以后,我就感覺我以前的學習方法是錯誤的。以前我只注重于代碼,而不注重理論知識以及編程的思路,程序的架構。以至于在些程序時沒有寫程序的思路,不能形成程序的架構。只想到看腦袋里是否有與此類似的代碼。越想程序越亂,最后腦袋里一片空白。不知道程序從哪個方面下手了。軟件工程這門課程是做軟件開發的人必學的課程,通過學這門課程,程序員就會注重軟件開發的理論知識,以及做工程開發的思路
15、。學了這門課程后你寫程序就不會去盲目的去套用代碼,而是理清此程序的架構以及思路。程序該從什么時候開始,什么時候結束。在中間需要添加什么樣的功能,以完善該軟件。在設計初期,首先溫習了課本內容,再次熟悉了一下C語言程序,然后廣泛的查找有關萬年歷的資料,并結合查找到的資料,整理出設計的主要思路,畫出流程圖,最終寫出了源程序,并編譯成功,在實驗中,碰到了不少問題,其中包括如何獲取系統時間,如何計算任意時間的時間差,這些困難,都通過查閱資料和問同學得到了解決。當然,由于時間和能力的原因,做得還不是很完美。在這學期的課程序設計中,收獲知識的同時,還收獲了閱歷,收獲了成熟,通過查找大量資料,請教老師,以及不懈的努力,不僅培養了獨立思考、 動手制作的能力,在各種其它能力上也都有了提高。更重要的是,在課程序設計里,我們學會了很多學習的方法,知道了理論和實踐的巨大差異。而這是以后最實用的,真的是受益匪淺。要面 對社會的挑戰,只有不斷的
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 官方獸醫管理辦法思考
- 宜昌公職律師管理辦法
- 監理企業創新管理辦法
- 基金公司專戶管理辦法
- 賽事運營服務管理辦法
- 自助政務服務管理辦法
- 道路通行效率管理辦法
- 居民醫保基金管理辦法
- 成本預算薪酬管理辦法
- 房屋租憑安全管理辦法
- 2024北京石景山四年級(下)期末數學試題及答案
- 2025-2030機頂盒(STB)行業市場現狀供需分析及投資評估規劃分析研究報告
- 云南省昆明地區2025屆小升初模擬數學測試卷含解析
- SL631水利水電工程單元工程施工質量驗收標準第4部分:堤防與河道整治工程
- 胃息肉術后的護理查房
- 富海(菏澤)新能源發展有限公司富海單縣200MW集中式風電項目配套220kV升壓站項目報告表
- GMI傳感器在無損檢測技術中的應用研究進展
- 四川成都歷年中考作文題與審題指導(2005-2024)
- 2025煤礦井巷工程建設項目合同
- 《中華民族共同體概論》第十四講新中國與中華民族新紀元課件
- 安徽省2024年普通高校招生普通本科批院校投檔分數及名次(物理科目組合)
評論
0/150
提交評論