安徽工业大学软件工程实验报告.doc

上传人:李医生 文档编号:5728109 上传时间:2020-07-24 格式:DOC 页数:14 大小:336KB
返回 下载 相关 举报
安徽工业大学软件工程实验报告.doc_第1页
第1页 / 共14页
安徽工业大学软件工程实验报告.doc_第2页
第2页 / 共14页
安徽工业大学软件工程实验报告.doc_第3页
第3页 / 共14页
安徽工业大学软件工程实验报告.doc_第4页
第4页 / 共14页
安徽工业大学软件工程实验报告.doc_第5页
第5页 / 共14页
点击查看更多>>
资源描述

《安徽工业大学软件工程实验报告.doc》由会员分享,可在线阅读,更多相关《安徽工业大学软件工程实验报告.doc(14页珍藏版)》请在三一文库上搜索。

1、软件工程实验报告 姓 名:胡成柱 学 号:129074044 班 级:计算机科学与技术122 指导老师:周兵 日 期:2015年05月一 实验目的1能按照软件工程的思想,采用面向过程的方法开发出一个小型软件系统。2在软件系统开发过程中,能综合利用一门编程语言和软件工程等多门课程的知识。 3培养良好的软件开发习惯,了解软件企业文化。 4掌握结构化数据流分析技术。 5掌握结构化程序设计的基本概念与技术,并且养成良好的编码风格。 6掌握单元测试的一般步骤及技术。 7掌握集成测试的一般步骤和技术。二 实验内容1 软件需求分析 、功能需求分析输入一个年份(1-3000),然后显示12个月的月历能解决闰年

2、和平年问题能输出显示结果、运行需求分析 操作系统: Windows9x, Windows2000, Windows XP及更高版本、数据流图是否闰年确定年份开始信息开始信息年份显示其他月份显示12月错误显示表头计算1月1日检查输入年份任意键年份年份非法显示2月显示1月 软件结构图:mainsetinit()output()inputyear()checkinput()setinfo()printmonth()printhead()isleap ()2 软件设计与编码#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

4、 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 module is to accept inputyear() and check if it is correct. if it is correct it return int year, otherw

5、ise 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); pri

7、ntmonth(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.mo

8、nth) 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,ga

9、p,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=mo

10、nthinfo.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+ mon

11、thinfo.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

12、is 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.d

13、aysofmonth=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);3 单元测试 白盒测试黑盒测试2015年三月四月五月六月2016年:三 总结1 实验内容总结实验时按照步骤进行,利用VC+6.0作为编程环境,

14、参考网上的资料和代码逐渐了解到万年历的真正的强大的功能,然而在实验中并不是那么一帆风顺,编译时老是有错误,好在通过网上搜索资料和同学老师们的帮忙,我才一一解决这些问题。通过此实验我发现数据流图还是比较重要的,这次实验相当于让我再一次熟悉c语言的魅力所在。2 心得体会与建议对于这次实验,由于这门课是双语教学,英语不是很好的我开始理解有一定的难度,经过一定的努力才慢慢入门。经过对实验的研究,我按照软件工程的思想,把理论应用到了实践当中。采用面向过程的方法开发出了一个万年历的小程序。培养了良好的软件开发习惯,了解了一点软件的企业文化。掌握了一定的结构化数据流分析技术。了解了一定的结构化设计的基本概念与技术,对于以前学习的C语言知识有了更深的了解和更好的应用。对子函数的应用更得心应手。总之,这次实验让我受益匪浅。

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 科普知识


经营许可证编号:宁ICP备18001539号-1