




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、软件工程实验报告姓 名:江文杰 学 号:139074333 班 级:网133 指导老师:周兵一 实验目的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 <stdio。hinclude ctype.h>#include stdlib。hinclude &
3、lt;math。hdefine 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 inputyear(void);int isleap(int y);void output(struct in
4、fo);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 y100!=0) y400=0);/ This module is to accept inputyear() and check if it is correct。 if it is correc
5、t 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(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)
6、char s80; int i, y; y=1; printf(”请输入年份(13000):"); 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 in
7、fo monthinfo) char ch; do printhead(monthinfo); printmonth(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(struc
8、t info monthinfo) char ss; printf("s”,dent); switch(monthinfo。month) 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; c
9、ase 9: ss="九 月”; break; case 10: ss=”十 月"; break; case 11: ss=”十一 月" break; case 12: ss=”十二 月”; printf(” %ssssnn”,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); prin
10、tf(”一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=monthinfo.firstdayofmonth; for(j=1;j=monthinfo。daysofmonth;j=j+1) if(k7) k=k-7; printf("nns”,dent); ; k=k+1; printf("%2d%s”,j,gap); printf(”nn”);/* T
11、his 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+ monthinfo。daysofmonth1)%7+1; monthinfo.month=monthinfo。month+1; monthinfo。daysofmonth=30; m=monthinfo。month; if(
12、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 is to initialize the monthinfo。 /struct info setinit(int year) int i,days,total; struct info monthinfo; monthinfo.m
13、onth=1; monthinfo.firstdayofmonth=firstdayof1; for(i=1;iyear;i=i+1) if(isleap(i) days=366; else days=365 ; monthinfo。firstdayofmonth=(monthinfo.firstdayofmonth+days1)7+1; monthinfo。daysofmonth=31; monthinfo。leap=isleap(year); return monthinfo;void main()printf(” tt* n”);printf(" tt欢迎使用万年历演示程序 n
14、");printf(” tt* n”); int year ; struct info monthinfo; year = checkinput(); monthinfo = setinit(year); output(monthinfo);3 单元测试 白盒测试黑盒测试2015年三月四月五月六月2016年:三 总结和体会本次用C语言编写的万年历系统主要实现了年历、月历、日历的显示.我根本就不喜欢敲代码了,看见代码就头疼。所以感觉厌恶这门专业,对学习也不感兴趣了。而且,还有一件更头疼的事是在写一个简单的程序时竟然老是出错,难一点的,复杂一点的程序竟然无从下手。但是去看程序的参考答案时
15、都看得懂,又感觉很容易。学了软件工程以后,我就感觉我以前的学习方法是错误的.以前我只注重于代码,而不注重理论知识以及编程的思路,程序的架构.以至于在些程序时没有写程序的思路,不能形成程序的架构。只想到看脑袋里是否有与此类似的代码。越想程序越乱,最后脑袋里一片空白.不知道程序从哪个方面下手了.软件工程这门课程是做软件开发的人必学的课程,通过学这门课程,程序员就会注重软件开发的理论知识,以及做项目开发的思路。学了这门课程后你写程序就不会去盲目的去套用代码,而是理清此程序的架构以及思路。程序该从什么时候开始,什么时候结束。在中间需要添加什么样的功能,以完善该软件。在设计初期,首先温习了课本内容,再次
16、熟悉了一下C语言程序,然后广泛的查找有关万年历的资料,并结合查找到的资料,整理出设计的主要思路,画出流程图,最终写出了源程序,并编译成功,在实验中,碰到了不少问题,其中包括如何获取系统时间,如何计算任意时间的时间差,这些困难,都通过查阅资料和问同学得到了解决。当然,由于时间和能力的原因,做得还不是很完美。在这学期的课程序设计中,收获知识的同时,还收获了阅历,收获了成熟,通过查找大量资料,请教老师,以及不懈的努力,不仅培养了独立思考、 动手制作的能力,在各种其它能力上也都有了提高。更重要的是,在课程序设计里,我们学会了很多学习的方法,知道了理论和实践的巨大差别.而这是以后最实用的,真的是受益匪浅。要面 对社会的
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年区块链技术在跨境支付中的合规性与稳定性研究报告
- 烟柜租用协议书
- 伪代持协议书
- 2025福建南平市供电服务有限公司招聘52人模拟试卷附答案详解(考试直接用)
- 2025年潍坊市寒亭区人民检察院公开招聘工作人员笔试模拟试卷含答案详解
- 新能源产业2025年危机公关案例分析报告:技术创新与策略升级
- 2025春季中材国际校园招聘163人考前自测高频考点模拟试题及参考答案详解1套
- 2025年温州南白象街道社区卫生服务中心面向社会公开招聘1人考前自测高频考点模拟试题及参考答案详解一套
- 2025-2030年储能技术商业化应用与市场潜力分析报告
- 2025内蒙古深能北方能源控股有限公司招聘考前自测高频考点模拟试题及一套参考答案详解
- 2025-2026学年统编版语文八年级上册第二单元检测卷(含答案)
- 人教版数学(2024)一年级上册第四单元 11~20的认识 达标测试卷(含解析)
- 2025山东济南市莱芜高新投资控股有限公司社会招聘10人笔试参考题库附带答案详解
- 第一二单元月考综合测试(试题)人教版数学六年级上册
- 2025年年少先队知识竞赛考试真题题库及答案
- 2025年厦大《诚信复试承诺书》
- 外泌体课件教学课件
- 低空经济产业园产学研融合方案
- 2025年冰淇淋行业研究报告及未来行业发展趋势预测
- 2025-2030中国农村宅基地三权分置改革试点经验总结报告
- 医院安全生产检查表范本
评论
0/150
提交评论