




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、軟件工程實驗報告 姓 名:江文杰 學 號:139074333 班 級:網133 指導老師:周兵 一 實驗目的1能按照軟件工程的思想,采用面向過程的方法開發(fā)出一個小型軟件系統(tǒng)。2在軟件系統(tǒng)開發(fā)過程中,能綜合利用一門編程語言和軟件工程等多門課程的知識。 3培養(yǎng)良好的軟件開發(fā)習慣,了解軟件企業(yè)文化。 4掌握結構化數(shù)據(jù)流分析技術。 5掌握結構化程序設計的基本概念與技術,并且養(yǎng)成良好的編碼風格。 6掌握單元測試的一般步驟及技術。 7掌握集成測試的一般步驟和技術。二 實驗內容1 軟件需求分析 、功能需求分析·輸入一個年份(1-3000),然后顯示12個月的月歷·能解決閏年和平年問題
2、183;能輸出顯示結果、運行需求分析· 操作系統(tǒng): Windows9x, Windows2000, Windows XP及更高版本、數(shù)據(jù)流圖是否閏年確定年份開始信息開始信息年份顯示其他月份顯示12月錯誤顯示表頭計算1月1日檢查輸入年份任意鍵年份年份非法顯示2月顯示1月 軟件結構圖:mainsetinit()output()inputyear()checkinput()setinfo()printmonth()printhead()isleap ()2 軟件設計與編碼#include <stdio.h>#include <ctype.h>#include <
3、;stdlib.h>#include <math.h>#define firstdayof1 1 /* 定義第一年的第一天, 星期日=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
4、 inputyear(void);int isleap(int y);void output(struct info);void printhead(struct info );void printmonth(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 m
5、odule is to accept inputyear() and check if it is correct. if it is correct it return int year, otherwise ask user reenter */ int checkinput(void) int y; do y=inputyear(); if(y<1 | y >3000) printf("n輸入錯誤!。nn"); y=0; while(y<1); return y; /* This function is to accept the input yea
6、r, 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):"); for(i=0;i<80;+i) si=getchar(); if(si=27) exit(0); if(si=10) break; for(i=0;i<80;+i) if(si=10) break; else if(!isdigit(si) return y; y=atoi(s); retu
7、rn y;/*This module is to accept monthinfo, and print the whole year calender. */void output(struct info monthinfo) char ch; do printhead(monthinfo); printmonth(monthinfo); printf("按任意鍵顯視下一月, 按Esc鍵退出. n"); ch=getchar(); if(ch=27) exit(0); monthinfo=setmonthinfo(monthinfo); while(monthinfo.m
8、onth<13);/* This module is to accept monthinfo, amd print monthly head like"一 月" */void printhead(struct info monthinfo) char *ss; printf("%s",dent); switch(monthinfo.month) case 1: ss="一 月" break; case 2: ss="二 月" break; case 3: ss="三 月" break; c
9、ase 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="十二 月&quo
10、t; printf(" %s%s%s%snn",gap,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"
11、;,dent); for(i=1;i<monthinfo.firstdayofmonth;i=i+1) printf("%s ",gap); k=monthinfo.firstdayofmonth; for(j=1;j<=monthinfo.daysofmonth;j=j+1) if(k>7) k=k-7; printf("nn%s",dent); ; k=k+1; printf("%2d%s",j,gap); printf("nn");/* This module is to accept th
12、e monthinfo, and set the monthinfo of next month. */ struct info setmonthinfo(struct info monthinfo) int m; monthinfo.firstdayofmonth= (monthinfo.firstdayofmonth+ monthinfo.daysofmonth-1)%7+1; monthinfo.month=monthinfo.month+1; monthinfo.daysofmonth=30; m=monthinfo.month; if(m=1 | m=3 | m=5 | m=7 |
13、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 is to initialize the monthinfo. */struct info setinit(int year) int i,days,total; struct info monthinfo; monthinfo.month=1; monthinfo.
14、firstdayofmonth=firstdayof1; for(i=1;i<year;i=i+1) if(isleap(i) days=366; else days=365 ; monthinfo.firstdayofmonth=(monthinfo.firstdayofmonth+days-1)%7+1; monthinfo.daysofmonth=31; monthinfo.leap=isleap(year); return monthinfo; void main()printf(" tt* n");printf(" tt歡迎使用萬年歷演示程序 n&
15、quot;);printf(" tt* n"); int year ; struct info monthinfo; year = checkinput(); monthinfo = setinit(year); output(monthinfo);3 單元測試 白盒測試黑盒測試2015年三月四月五月六月2016年:三 總結和體會本次用C語言編寫的萬年歷系統(tǒng)主要實現(xiàn)了年歷、月歷、日歷的顯示。我根本就不喜歡敲代碼了,看見代碼就頭疼。所以感覺厭惡這門專業(yè),對學習也不感興趣了。而且,還有一件更頭疼的事是在寫一個簡單的程序時竟然老是出錯,難一點的,復雜一點的程序竟然無從下手。但是去
16、看程序的參考答案時都看得懂,又感覺很容易。學了軟件工程以后,我就感覺我以前的學習方法是錯誤的。以前我只注重于代碼,而不注重理論知識以及編程的思路,程序的架構。以至于在些程序時沒有寫程序的思路,不能形成程序的架構。只想到看腦袋里是否有與此類似的代碼。越想程序越亂,最后腦袋里一片空白。不知道程序從哪個方面下手了。軟件工程這門課程是做軟件開發(fā)的人必學的課程,通過學這門課程,程序員就會注重軟件開發(fā)的理論知識,以及做項目開發(fā)的思路。學了這門課程后你寫程序就不會去盲目的去套用代碼,而是理清此程序的架構以及思路。程序該從什么時候開始,什么時候結束。在中間需要添加什么樣的功能,以完善該軟件。在設計初期,首先溫
17、習了課本內容,再次熟悉了一下C語言程序,然后廣泛的查找有關萬年歷的資料,并結合查找到的資料,整理出設計的主要思路,畫出流程圖,最終寫出了源程序,并編譯成功,在實驗中,碰到了不少問題,其中包括如何獲取系統(tǒng)時間,如何計算任意時間的時間差,這些困難,都通過查閱資料和問同學得到了解決。當然,由于時間和能力的原因,做得還不是很完美。在這學期的課程序設計中,收獲知識的同時,還收獲了閱歷,收獲了成熟,通過查找大量資料,請教老師,以及不懈的努力,不僅培養(yǎng)了獨立思考、 動手制作的能力,在各種其它能力上也都有了提高。更重要的是,在課程序設計里,我們學會了很多學習的方法,知道了理論和實踐的巨大差別。而這是以后最實用的,真的是受益匪淺。要面 對
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 河南省中創(chuàng)建筑工程有限公司-企業(yè)報告(供應商版)
- 2023-2028年中國鋁木復合模板行業(yè)發(fā)展前景預測及投資戰(zhàn)略咨詢報告
- 家庭裝修安全責任協(xié)議書
- 石英砂開采深加工項目可行性研究報告
- 品牌商標注冊與授權使用合同
- 農業(yè)信息技術服務及知識產權轉讓合同書
- 2025至2030建筑鋼材行業(yè)市場深度研究與戰(zhàn)略咨詢分析報告
- 六年級議論文一個硬幣的正反兩面800字(9篇)
- 二零二五年度高端活動場地租賃合同范本
- 2025版ISO9000質量認證咨詢與質量管理體系建設及培訓合同
- 2025屆新高考語文古詩文默寫100題匯編(含答案解析)
- 征信異議申訴合同(2篇)
- 《有效的時間管理》課件
- 中醫(yī)小兒貼敷培訓課件
- 自殺患者應急預案
- 路由路徑靠算法(課件)-七年級信息科技全一冊同步教學(人教版2024)
- 中建雙優(yōu)化案例指引
- 《幕墻維護維修技術規(guī)程》
- 康復設備及器材供貨安裝及售后服務方案
- 2023-2024學年北師大版八年級下冊期末數(shù)學試卷2(考試版)
- 小學五年級第一學期體育教案(新版)
評論
0/150
提交評論