安徽工业大学软件工程实验报告(共14页).doc





《安徽工业大学软件工程实验报告(共14页).doc》由会员分享,可在线阅读,更多相关《安徽工业大学软件工程实验报告(共14页).doc(14页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、精选优质文档-倾情为你奉上软件工程实验报告 姓 名:江文杰 学 号: 班 级:网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 #include #include #include #define firstdayof1 1 /* 定义第一年的第一天, 星期日=7 */
3、#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 printmonth(str
4、uct 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, otherwise ask user re
5、enter */ 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):); for(i=0;i80;
6、+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); printmonth(monthin
7、fo); 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.month) case 1: ss
8、=一 月; 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,gap,gap,ss);/
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 安徽 工业大学 软件工程 实验 报告 14

限制150内