好文档 - 专业文书写作范文服务资料分享网站

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

天下 分享 时间: 加入收藏 我要投稿 点赞

《软件工程》实验报告

姓 名:江文杰

学 号:139074333 班 级:网133 指导老师:周兵

一. 实验目的

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

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

3.培养良好的软件开发习惯,了解软件企业文化。 4.掌握结构化数据流分析技术。

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

6.掌握单元测试的一般步骤及技术。 7.掌握集成测试的一般步骤和技术。 二. 实验内容 1. 软件需求分析

①、功能需求分析

·输入一个年份(1-3000),然后显示12个月的月历 ·能解决闰年和平年问题 ·能输出显示结果

谢谢你的观赏

②、运行需求分析

· 操作系统: Windows9x, Windows2000, Windows XP

及更高版本

③、数据流图 年份 年份 检查输 年份 确定年是否闰开始信计算1月1 显示1开始信显示2软件结构图: 年份 非法 错误 显示表头 main 任意键 setinit() output() checkinpu isleap () printheaprintmonsetinfo显示12月 显示其他月2. 软件设计与编码 inputyear#include

#include #include #include #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 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 );

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

int isleap(int y) {

return ((y%4==0 && y0!=0) || y@0==0); }

谢谢你的观赏

0

谢谢你的观赏

/* This module 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\\n\ y=0; }

}while(y<1); return y; }

/* This function is to accept the input year, if it is the integer, it returns it, */

int inputyear(void)

otherwise

it

return

-1

谢谢你的观赏

谢谢你的观赏

{

char s[80]; int i, 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; else if(!isdigit(s[i])) return y; }

y=atoi(s); return y; }

5nnqb2y1n555mbv23rb17u3cm9b9uy004m8
领取福利

微信扫码领取福利

微信扫码分享