统计模块报告书.docx
《统计模块报告书.docx》由会员分享,可在线阅读,更多相关《统计模块报告书.docx(22页珍藏版)》请在冰点文库上搜索。
统计模块报告书
《数据结构大型实验》
实验报告
学生姓名:
班级:
学院:
信息与通信工程学院
专业:
通信工程专业
实验题目:
仓库物资管理
完成时间:
2009-9-11
指导教师:
杨顺民、辛洁
一,需求分析:
作为一个仓库管理系统软件,要求能实现四类库存货品(黑色金属、有色金属、非金属、机械制品)信息的入库、出库、查找、统计等功能,并能建立和更新的库存信息保存于文件供输出或打印。
我们首先规定了货品的相关信息包括:
账号、品名、规格、单价、数量、金额,入库日期等,之后我们通过键盘输入货物的相关信息。
对于入库程序,我们要求能将入库的货物信息逐一插入链表。
对于出库程序,我们要求程序能完成对出库信息的记录,对库存物品的修改以及对客户信息的记录。
对于查找程序,我们要求程序可以通过账号进行查询。
对于统计功程序,我们要求程序可以显示仓库货物的数量和价格并按月、季、年分别输出四大类物资的报表。
整个程序运行时,我们只需按屏幕上的提示进行自己需要的操作就行了。
输入数据类型:
整型、字符型、结构体;
输入数据的取值范围:
0至12;
输出数据类型:
整型、字符型;
二,概要设计:
1.方案确定:
库存货品信息管理系统要求实现许多功能,可遵循结构化程序设计思想来进行本系统的设计,通过小组讨论,我们决定采用线性链表的结构来储存货物信息。
并把整个系统分为五个模块:
入库模块,出库模块,查询模块,统计模块和主函数模块。
运行时,通过主函数的调用来实现所需的功能。
其中本程序中用到的抽象数据类型的定义有:
线性链表结构体的定义;创建链表的头节点以及在进行入库时货物存储即链表的插入,出库时链表的删除等;头节点声明,以及函数调用时的声明等。
2.具体结构:
库存货品信息管理系统的软件具体结构如图:
库存货品信息管理系统
主程序模块
查询模块
询模块
出库模块
统计模块
入库模块
3.模块功能说明:
对本系统的功能进行分析后可作如下的模块化设计:
入库模块实现功能:
能把货品信息按四大类逐一输入,并对其进行插入,删除,查找。
出库模块实现功能:
能把已经出库的物资从四类链表中插入,删除,查找。
查询模块实现功能:
用户可以通过帐号查找相应的货品的信息。
统计模块实现功能:
程序可以显示仓库货物表和按月、季、年输出报表。
主程序模块实现功能:
完成主菜单的显示,及对各模块的调用。
…………………………
数据流程图
身份验证
开始
统计模块
查询模块
出库模块
入库模块
库存物品信息的月报表
库存物品信息的季报表
库存物品信息的年报表
对机械制品信息的查询
对非金属信息的查询
对有色金属信息的查询
对黑色金属信息的查询
对机械制品的修改
对非金属的修改
对有色金属的修改
对黑色金属的
修改
对机械制品的插入、删除
对非金属的插入、删除
对有色金属的插入、删除
对黑色金属的插入、删除
货物(货物代码,货物名,型号,数量,单价,销售价,日期)
出库(出库单号,货物代码,货品名,数量,单价,总价,日期)
三,详细设计
在这次的程序设计中,我负责的是统计模块,统计模块我们要求程序能实现四大类产品的月,季,年的统计并输出各产品的相关信息。
在前面的划分模块中,我们是有定义四个产品结构体,统计的时候我们是在产品定义中把时间分为年、月、日,在统计的程序中我们在比较时间时更易于设计程序。
四种产品中我们分别设计了它的年、月、日统计程序,在我们的主函数中实现函数的调用,来实现四种产品的年、月、日的统计。
1.结构体定义
验证结构体:
structbaomi
{
chardlms[12];
intmm;
structbaimi*next;
};
structbaomi*hand;
产品结构体(以黑色金属为例):
structheise_product
{
charnum[12];
charp_num[12];
charname[12];
intamount;
intprice;
intt_price;
intyear;
intseason;
intmonth;
intday;
structheise_product*next;
};
structheise_product*hhead;
客户信息结构体:
structkehu_information
{
charkname[12];
charname[12];
charnum[12];
intamount;
intdate;
structkehu_information*next;
};
structkehu_information*khead;
2、货物的统计:
(1)月统计(以黑色金属为例):
voidheise_yuetotal()
{
heise_product*p,*q;
intyear,month;
inty,m,num,p_num,amount,price,t_price;
charname[12];
q=p=hhead;
while(p)
{
y=p->year;m=q->month;
printf("Endertheyearofchoice\n");
scanf("%d%d",&year,&month);
if(y==year&&m==month)
printf("%d%d%s%d%d%d",&num,&p_num,&name,&amount,&price,&t_price);
q->next;
}
}
(2)季统计(以有色金属为例):
voidheise_jitotal()
{
structheise_product*p,*q;
intyear,season;
inty,s,num,p_num,amount,price,t_price;
charname[12];
q=p=hhead;
while(p)
{
y=p->year;s=q->season;
printf("Endertheyearofchoice\n");
scanf("%d%d",&year,&season);
if(y==year&&s==season)
printf("%d%d%s%d%d%d",&num,&p_num,&name,&amount,&price,&t_price);
q->next;
}
}
(3)年统计(以黑色金属为例):
voidheise_niantotal()
{
structheise_product*p;
inty,year;
intnum,p_num,amount,price,t_price;
charname[12];
p=hhead;
while(p)
{
y=p->year;
printf("Endertheyearofchoice\n");
scanf("%d",&year);
if(y==year)
printf("%d%d%s%d%d%d",&num,&p_num,&name,&amount,&price,&t_price);
p->next;
}
}
五,测试结果
说明:
我们设计的程序最终没能实现程序的正确的运行,我们通过询问各个老师和同学,得出了我们程序设计的缺陷,我们在设计建立产品的四个链表时,出现了四种链表的调用混乱,使计算机的内存总是不够,如上图:
六,经验总结
整体我们所设计的完整总程序是能够运行的,但存在一定不足:
因为此报告上的程序为答辩后在老师的建议与指导下再次进行修改的程序,所以与参加答辩时用的程序有所不同,把不能详细指明出库信息的情况给改正了,但由于时间原因,还是存在很多细节问题,有待更完善的处理。
我在定义产品的结构体时原来是定义一个时间,但是在统计设计程序的时,我们无法按时间统计产品的输出情况,后来经过我们小组的讨论,我们把时间date分别定义成年,季,月,日四部分,在统计部分我就可以利用产品的时间设定统计的程序。
同时,在编写统计模块的程序时,我也遇到来例如没有定义指针,没有命名的结构体等问题,在上机调试时出现了好多的错误,但是,在老师和组员的帮助下,我克服了一个又一个错误,通过不断的调试,直到统计模块的程序语法无误,正常运行,但是我们的程序的有些功能还不能实现。
通过这次程序设计课题的完成,感觉收获颇多,我的动手能力得到了很大的提高,也让我明白团队合作的重要性,我们四个组员在两个星期的学习,交流,探讨中付出了汗水,收获了可贵的经验。
最后在老师的建议与指导下再次进行修改的程序,已经弥补了上述不足,在此程序设计报告中即用的是修改后的程序。
整个实验,让我对c语言和数据结构有了一次温习,并学到了很多新的东西,对c语言和数据结构有了更好的掌握,同时也感到了个人力量的薄弱,团队精神的重要。
由于时间短暂,程序还有很多不足,比如在查找方式和统计有些模块上还不是很不方便,算法也有些繁琐,有待今后的改进。
还望老师多多指点。
七、附录
程序设计如下:
structheise_product/*黑色物品线形链表出库的结构体定义*/
{
charnum[12];/*黑色物品出库帐号的定义*/
charp_num[12];/*黑色物品产品规格的定义*/
charname[12];/*黑色物品出库产品名称的定义*/
intamount;/*出库数量的定义*/
intprice;/*出库单价的定义*/
intt_price;/*出库总价的定义*/
intyear;/*出库年份*/
intseason;/*出库季节*/
intmonth;/*出库月份*/
intday;/*出库日期*/
structheise_product*next;/*黑色物品出库指针的定义*/
};
structheise_product*hhead;/*出库产品建立一个头指针*/
structyouse_product/*有色物品线形链表出库的结构体定义*/
{
charnum[12];/*有色物品出库帐号的定义*/
charp_num[12];/*有色物品产品规格的定义*/
charname[12];/*有色物品出库产品名称的定义*/
intamount;/*出库数量的定义*/
intprice;/*出库单价的定义*/
intt_price;/*出库总价的定义*/
intyear;/*出库年份*/
intseason;/*出库季节*/
intmonth;/*出库月份*/
intday;/*出库日期*/
structyouse_product*next;/*有色物品出库指针的定义*/
};
structyouse_product*yhead;/*出库产品建立一个头指针*/
structfei_product/*非金属物品线形链表出库的结构体定义*/
{
charnum[12];/*非金属物品出库帐号的定义*/
charp_num[12];/*非金属物品产品规格的定义*/
charname[12];/*非金属物品出库产品名称的定义*/
intamount;/*出库数量的定义*/
intprice;/*出库单价的定义*/
intt_price;/*出库总价的定义*/
intyear;/*出库年份*/
intseason;/*出库季节*/
intmonth;/*出库月份*/
intday;/*出库日期*/
structfei_product*next;/*非金属物品出库指针的定义*/
};
structfei_product*fhead;/*出库产品建立一个头指针*/
structjixie_product/*机械制品线形链表出库的结构体定义*/
{
charnum[12];/*机械制品物品出库帐号的定义*/
charp_num[12];/*机械制品产品规格的定义*/
charname[12];/*机械制品出库产品名称的定义*/
intamount;/*出库数量的定义*/
intprice;/*出库单价的定义*/
intt_price;/*出库总价的定义*/
intyear;/*出库年份*/
intseason;/*出库季节*/
intmonth;/*出库月份*/
intday;/*出库日期*/
structjixie_product*next;/*机械制品出库指针的定义*/
};
structjixie_product*jhead;/*出库产品建立一个头指针*/
voidheise_yuetotal()
{
heise_product*p,*q;
intyear,month;
inty,m,num,p_num,amount,price,t_price;
charname[12];
q=p=hhead;
while(p)
{
y=p->year;m=q->month;
printf("Endertheyearofchoice\n");
scanf("%d%d",&year,&month);
if(y==year&&m==month)
printf("%d%d%s%d%d%d",&num,&p_num,&name,&amount,&price,&t_price);
q->next;
}
}
voidyouse_yuetotal()
{
structyouse_product*p,*q;
intyear,month;
inty,m,num,p_num,amount,price,t_price;
charname[12];
q=p=yhead;
while(p)
{
y=p->year;m=q->month;
printf("Endertheyearofchoice\n");
scanf("%d%d",&year,&month);
if(y==year&&m==month)
printf("%d%d%s%d%d%d",&num,&p_num,&name,&amount,&price,&t_price);
q->next;
}
}
voidfei_yuetotal()
{
structfei_product*p,*q;
intyear,month;
inty,m,num,p_num,amount,price,t_price;
charname[12];
q=p=fhead;
while(p)
{
y=p->year;m=q->month;
printf("Endertheyearofchoice\n");
scanf("%d%d",&year,&month);
if(y==year&&m==month)
printf("%d%d%s%d%d%d",&num,&p_num,&name,&amount,&price,&t_price);
q->next;
}
}
voidjixie_yuetotal()
{
structjixie_product*p,*q;
intyear,month;
inty,m,num,p_num,amount,price,t_price;
charname[12];
q=p=jhead;
while(p)
{
y=p->year;m=q->month;
printf("Endertheyearofchoice\n");
scanf("%d%d",&year,&month);
if(y==year&&m==month)
printf("%d%d%s%d%d%d",&num,&p_num,&name,&amount,&price,&t_price);
q->next;
}
}
voidheise_jitotal()
{
structheise_product*p,*q;
intyear,season;
inty,s,num,p_num,amount,price,t_price;
charname[12];
q=p=hhead;
while(p)
{
y=p->year;s=q->season;
printf("Endertheyearofchoice\n");
scanf("%d%d",&year,&season);
if(y==year&&s==season)
printf("%d%d%s%d%d%d",&num,&p_num,&name,&amount,&price,&t_price);
q->next;
}
}
voidyouse_jitotal()
{
structyouse_product*p,*q;
intyear,season;
inty,s,num,p_num,amount,price,t_price;
charname[12];
q=p=yhead;
while(p)
{
y=p->year;s=q->season;
printf("Endertheyearofchoice\n");
scanf("%d%d",&year,&season);
if(y==year&&s==season)
printf("%d%d%s%d%d%d",&num,&p_num,&name,&amount,&price,&t_price);
q->next;
}
}
voidfei_jitotal()
{
structfei_product*p,*q;
intyear,season;
inty,s,num,p_num,amount,price,t_price;
charname[12];
q=p=fhead;
while(p)
{
y=p->year;s=q->season;
printf("Endertheyearofchoice\n");
scanf("%d%d",&year,&season);
if(y==year&&s==season)
printf("%d%d%s%d%d%d",&num,&p_num,&name,&amount,&price,&t_price);
q->next;
}
}
voidjixie_jitotal()
{
structjixie_product*p,*q;
intyear,season;
inty,s,num,p_num,amount,price,t_price;
charname[12];
q=p=jhead;
while(p)
{
y=p->year;s=q->season;
printf("Endertheyearofchoice\n");
scanf("%d%d",&year,&season);
if(y==year&&s==season)
printf("%d%d%s%d%d%d",&num,&p_num,&name,&amount,&price,&t_price);
q->next;
}
}
voidheise_niantotal()
{
structheise_product*p;
inty,year;
intnum,p_num,amount,price,t_price;
charname[12];
p=hhead;
while(p)
{
y=p->year;
printf("Endertheyearofchoice\n");
scanf("%d",&year);
if(y==year)
printf("%d%d%s%d%d%d",&num,&p_num,&name,&amount,&price,&t_price);
p->next;
}
}
voidyouse_niantotal()
{
structyouse_product*p;
inty,year;
intnum,p_num,amount,price,t_price;
charname[12];
p=yhead;
while(p)
{
y=p->year;
printf("Endertheyearofchoice\n");
scanf("%d",&year);
if(y==year)
printf("%d%d%s%d%d%d",&num,&p_num,&name,&amount,&price,&t_price);
p->next;
}
}
voidfei_niantotal()
{
structfei_product*p;
inty,year;
intnum,p_num,amount,price,t_price;
charname[12];
p=fhead;
while(p)
{
y=p->year;
printf("Endertheyearofchoice\n");
scanf("%d",&year);
if(y==year)
printf("%d%d%s%d%d%d",&num,&p_num,&name,&amount,&price,&t_price);
p->next;
}
}
voidjixie_niantotal()
{
structjixie_product*p;
inty,year;
intnum,p_num,amount,price,t_price;
charname[12];
p=jhead;
while(p)
{
y=p->year;
printf("Endertheyearofchoice\n");
scanf("%d",&year);
if(y==year)
printf("%d%d%s%d%d%d",&num,&p_num,&name,&amount,&price,&t_price);
p->next;
}
}
intmain()
{
intchoice;
while
(1)
{
scanf("%d",&choi