




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、軟件工程實(shí)驗(yàn)報(bào)告 姓 名:江文杰 學(xué) 號(hào):139074333 班 級(jí):網(wǎng)133 指導(dǎo)老師:周兵 一 實(shí)驗(yàn)?zāi)康?能按照軟件工程的思想,采用面向過(guò)程的方法開(kāi)發(fā)出一個(gè)小型軟件系統(tǒng)。2在軟件系統(tǒng)開(kāi)發(fā)過(guò)程中,能綜合利用一門編程語(yǔ)言和軟件工程等多門課程的知識(shí)。 3培養(yǎng)良好的軟件開(kāi)發(fā)習(xí)慣,了解軟件企業(yè)文化。 4掌握結(jié)構(gòu)化數(shù)據(jù)流分析技術(shù)。 5掌握結(jié)構(gòu)化程序設(shè)計(jì)的基本概念與技術(shù),并且養(yǎng)成良好的編碼風(fēng)格。 6掌握單元測(cè)試的一般步驟及技術(shù)。 7掌握集成測(cè)試的一般步驟和技術(shù)。二 實(shí)驗(yàn)內(nèi)容1 軟件需求分析 、功能需求分析·輸入一個(gè)年份(1-3000),然后顯示12個(gè)月的月歷·能解決閏年和平年問(wèn)題
2、183;能輸出顯示結(jié)果、運(yùn)行需求分析· 操作系統(tǒng): Windows9x, Windows2000, Windows XP及更高版本、數(shù)據(jù)流圖是否閏年確定年份開(kāi)始信息開(kāi)始信息年份顯示其他月份顯示12月錯(cuò)誤顯示表頭計(jì)算1月1日檢查輸入年份任意鍵年份年份非法顯示2月顯示1月 軟件結(jié)構(gòu)圖:mainsetinit()output()inputyear()checkinput()setinfo()printmonth()printhead()isleap ()2 軟件設(shè)計(jì)與編碼#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 );/* 這個(gè)作用是判斷年, 如果是閏年, 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輸入錯(cuò)誤!。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("請(qǐng)輸入年份(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歡迎使用萬(wàn)年歷演示程序 n&
15、quot;);printf(" tt* n"); int year ; struct info monthinfo; year = checkinput(); monthinfo = setinit(year); output(monthinfo);3 單元測(cè)試 白盒測(cè)試黑盒測(cè)試2015年三月四月五月六月2016年:三 總結(jié)和體會(huì)本次用C語(yǔ)言編寫的萬(wàn)年歷系統(tǒng)主要實(shí)現(xiàn)了年歷、月歷、日歷的顯示。我根本就不喜歡敲代碼了,看見(jiàn)代碼就頭疼。所以感覺(jué)厭惡這門專業(yè),對(duì)學(xué)習(xí)也不感興趣了。而且,還有一件更頭疼的事是在寫一個(gè)簡(jiǎn)單的程序時(shí)竟然老是出錯(cuò),難一點(diǎn)的,復(fù)雜一點(diǎn)的程序竟然無(wú)從下手。但是去
16、看程序的參考答案時(shí)都看得懂,又感覺(jué)很容易。學(xué)了軟件工程以后,我就感覺(jué)我以前的學(xué)習(xí)方法是錯(cuò)誤的。以前我只注重于代碼,而不注重理論知識(shí)以及編程的思路,程序的架構(gòu)。以至于在些程序時(shí)沒(méi)有寫程序的思路,不能形成程序的架構(gòu)。只想到看腦袋里是否有與此類似的代碼。越想程序越亂,最后腦袋里一片空白。不知道程序從哪個(gè)方面下手了。軟件工程這門課程是做軟件開(kāi)發(fā)的人必學(xué)的課程,通過(guò)學(xué)這門課程,程序員就會(huì)注重軟件開(kāi)發(fā)的理論知識(shí),以及做項(xiàng)目開(kāi)發(fā)的思路。學(xué)了這門課程后你寫程序就不會(huì)去盲目的去套用代碼,而是理清此程序的架構(gòu)以及思路。程序該從什么時(shí)候開(kāi)始,什么時(shí)候結(jié)束。在中間需要添加什么樣的功能,以完善該軟件。在設(shè)計(jì)初期,首先溫
17、習(xí)了課本內(nèi)容,再次熟悉了一下C語(yǔ)言程序,然后廣泛的查找有關(guān)萬(wàn)年歷的資料,并結(jié)合查找到的資料,整理出設(shè)計(jì)的主要思路,畫出流程圖,最終寫出了源程序,并編譯成功,在實(shí)驗(yàn)中,碰到了不少問(wèn)題,其中包括如何獲取系統(tǒng)時(shí)間,如何計(jì)算任意時(shí)間的時(shí)間差,這些困難,都通過(guò)查閱資料和問(wèn)同學(xué)得到了解決。當(dāng)然,由于時(shí)間和能力的原因,做得還不是很完美。在這學(xué)期的課程序設(shè)計(jì)中,收獲知識(shí)的同時(shí),還收獲了閱歷,收獲了成熟,通過(guò)查找大量資料,請(qǐng)教老師,以及不懈的努力,不僅培養(yǎng)了獨(dú)立思考、 動(dòng)手制作的能力,在各種其它能力上也都有了提高。更重要的是,在課程序設(shè)計(jì)里,我們學(xué)會(huì)了很多學(xué)習(xí)的方法,知道了理論和實(shí)踐的巨大差別。而這是以后最實(shí)用的,真的是受益匪淺。要面 對(duì)
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 電子商務(wù)網(wǎng)絡(luò)安全管理與應(yīng)用試題及答案
- 2024-2025學(xué)年高二英語(yǔ)人教版選擇性必修第三冊(cè)教學(xué)課件 UNIT 3 Assessing Your Progress
- 橋梁施工承包合同
- 互聯(lián)網(wǎng)教育行業(yè)用戶增長(zhǎng)趨勢(shì)表
- 文化娛樂(lè)產(chǎn)業(yè)收入數(shù)據(jù)表
- 房地產(chǎn)精裝修施工合同
- 健身訓(xùn)練計(jì)劃制定與執(zhí)行指南
- 動(dòng)物笑談科普知識(shí)與文學(xué)表達(dá)教案
- 用人單位聘用員工合同
- 廠房鋼結(jié)構(gòu)承包合同
- 2024年世界職業(yè)院校技能大賽高職組“市政管線(道)數(shù)字化施工組”賽項(xiàng)考試題庫(kù)
- 2024年職工普法教育宣講培訓(xùn)課件
- 自編冷庫(kù)庫(kù)容制冷量設(shè)備對(duì)照表
- “全員安全風(fēng)險(xiǎn)辨識(shí)”活動(dòng)實(shí)施方案
- 追覓科技在線測(cè)評(píng)邏輯題
- 凝中國(guó)心鑄中華魂鑄牢中華民族共同體意識(shí)-小學(xué)民族團(tuán)結(jié)愛(ài)國(guó)主題班會(huì)課件
- 第一編第3章 古希臘教育的興衰
- 女性更年期科普-健康科普課件
- 全過(guò)程工程咨詢管理服務(wù)方案投標(biāo)方案(技術(shù)方案)
- 2024年中考物理實(shí)驗(yàn)(全國(guó)版):探究光的反射定律(解析版)
- 四川省遂寧市2023-2024學(xué)年高二下學(xué)期期末考試地理試題
評(píng)論
0/150
提交評(píng)論