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

上传人:b****9 文档编号:94453 上传时间:2022-10-02 格式:DOC 页数:14 大小:353.27KB
下载 相关 举报
安徽工业大学软件工程实验报告.doc_第1页
第1页 / 共14页
安徽工业大学软件工程实验报告.doc_第2页
第2页 / 共14页
安徽工业大学软件工程实验报告.doc_第3页
第3页 / 共14页
安徽工业大学软件工程实验报告.doc_第4页
第4页 / 共14页
安徽工业大学软件工程实验报告.doc_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

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

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

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

《软件工程》实验报告

姓名:

江文杰

学号:

139074333

班级:

网133

指导老师:

周兵

一.实验目的

1.能按照软件工程的思想,采用面向过程的方法开发出一个小型软件系统。

2.在软件系统开发过程中,能综合利用一门编程语言和软件工程等多门课程的知识。

3.培养良好的软件开发习惯,了解软件企业文化。

4.掌握结构化数据流分析技术。

5.掌握结构化程序设计的基本概念与技术,并且养成良好的编码风格。

6.掌握单元测试的一般步骤及技术。

7.掌握集成测试的一般步骤和技术。

二.实验内容

1.软件需求分析

①、功能需求分析

·输入一个年份(1-3000),然后显示12个月的月历

·能解决闰年和平年问题

·能输出显示结果

②、运行需求分析

·操作系统:

Windows9x,Windows2000,WindowsXP及更高版本

③、数据流图

是否闰年

确定年份

开始信息

开始信息

年份

显示其他月份

显示12月

错误

显示表头

计算1月1日

检查输入

年份

任意键

年份

年份

非法

显示2月

显示1月

软件结构图:

main

setinit()

output()

inputyear()

checkinput()

setinfo()

printmonth()

printhead()

isleap()

2.软件设计与编码

#include

#include

#include

#include

#definefirstdayof11

/*定义第一年的第一天,星期日=7*/

#definegap""

/*setgapbetweennumbersofdates*/

#definedent""

/*setrightmargin.*/

structinfo{

intmonth;

intfirstdayofmonth;

intdaysofmonth;

intleap;

}monthinfo;

intcheckinput(void);

intinputyear(void);

intisleap(inty);

voidoutput(structinfo);

voidprinthead(structinfo);

voidprintmonth(structinfo);

structinfosetinit(int);

structinfosetmonthinfo(structinfo);

/*这个作用是判断年,如果是闰年,return1,否则

return0*/

intisleap(inty)

{

return((y%4==0&&y%100!

=0)||y%400==0);

}

/*Thismoduleistoacceptinputyear()andcheckifitiscorrect.ifitis

correctitreturnintyear,otherwiseaskuserreenter*/

intcheckinput(void)

{

inty;

do{

y=inputyear();

if(y<1||y>3000)

{

printf("\n输入错误!

\n\n");

y=0;

}

}while(y<1);

returny;

}

/*Thisfunctionistoaccepttheinputyear,ifitistheinteger,itreturns

it,otherwiseitreturn-1*/

intinputyear(void)

{

chars[80];

inti,y;

y=-1;

printf("请输入年份(1-3000):

");

for(i=0;i<80;++i)

{

s[i]=getchar();

if(s[i]==27)

exit(0);

if(s[i]==10)

break;

}

for(i=0;i<80;++i)

{

if(s[i]==10)break;

elseif(!

isdigit(s[i]))

returny;

}

y=atoi(s);

returny;

}

/*Thismoduleistoacceptmonthinfo,andprintthewholeyearcalender.*/

voidoutput(structinfomonthinfo)

{

charch;

do{

printhead(monthinfo);

printmonth(monthinfo);

printf("按任意键显视下一月,按Esc键退出.\n");

ch=getchar();

if(ch==27)

exit(0);

monthinfo=setmonthinfo(monthinfo);

}while(monthinfo.month<13);

}

/*Thismoduleistoacceptmonthinfo,amdprintmonthlyheadlike"一月"*/

voidprinthead(structinfomonthinfo)

{

char*ss;

printf("%s",dent);

switch(monthinfo.month)

{

case1:

ss="一月";

break;

case2:

ss="二月";

break;

case3:

ss="三月";

break;

case4:

ss="四月";

break;

case5:

ss="五月";

break;

case6:

ss="六月";

break;

case7:

ss="七月";

break;

case8:

ss="八月";

break;

case9:

ss="九月";

break;

case10:

ss="十月";

break;

case11:

ss="十一月";

break;

case12:

ss="十二月";

}

printf("%s%s%s%s\n\n",gap,gap,gap,ss);

}

/*Thismoduleistoacceptmonthinfo,andprintthenumbereddatesofthe

month.*/

voidprintmonth(structinfomonthinfo)

{

inti,j,k;

printf("%s",dent);

printf("一%s二%s三%s四%s五%s六%s日\n\n",gap,gap,gap,gap,gap,gap);

printf("%s",dent);

for(i=1;i

{

printf("%s",gap);

}

k=monthinfo.firstdayofmonth;

for(j=1;j<=monthinfo.daysofmonth;j=j+1)

{

if(k>7)

{

k=k-7;

printf("\n\n%s",dent);

};

k=k+1;

printf("%2d%s",j,gap);

}

printf("\n\n");

}

/*Thismoduleistoacceptthemonthinfo,andsetthemonthinfoofnextmonth.

*/

structinfosetmonthinfo(structinfomonthinfo)

{

intm;

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||m==8||m==10||m==12)

monthinfo.daysofmonth=31;

if(m==2)

{

if(monthinfo.leap)

monthinfo.daysofmonth=29;

else

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

当前位置:首页 > 初中教育 > 其它课程

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1