收藏 分销(赏)

产品进销存管理系统-课程设计报告书.doc

上传人:丰**** 文档编号:3990742 上传时间:2024-07-24 格式:DOC 页数:14 大小:43.04KB
下载 相关 举报
产品进销存管理系统-课程设计报告书.doc_第1页
第1页 / 共14页
产品进销存管理系统-课程设计报告书.doc_第2页
第2页 / 共14页
产品进销存管理系统-课程设计报告书.doc_第3页
第3页 / 共14页
产品进销存管理系统-课程设计报告书.doc_第4页
第4页 / 共14页
产品进销存管理系统-课程设计报告书.doc_第5页
第5页 / 共14页
点击查看更多>>
资源描述

1、中北大学数 据 结 构课 程 设 计 说 明 书学生姓名:宋立群学 号:1021011803学 院:软件学院专 业:软件开发与测试题 目:产品进销存管理系统指导教师何志英2011年12月20日(一)设计任务概述针对某一种行业的库房的产品进销存情况进行管理.1、采用一定的存储结构对库房的货品及其数量进行分类管理;运用链表进行存储,同时用到指针变量,运用循环存储,对存储产品的信息要用到日期结构体和产品结构体,对存储要用到文件指针以及文件的一些方法的使用.2、可以进行产品类的添加、产品的添加、产品数量的添加; 首先要找到链表的指针变量,对指针变量进行修改,然后再进行产品的出入。3、能够查询库房每种产

2、品的总量、进货日期、销出数量、销售时间等; 首先要定义一个查询函数,对产品类的指针变量进行循环查询,再对产品的指针变量进行循环查询,找到产品时,在调用显示产品信息函数,显示查询到的产品的各项信息。(二)本设计所采用的数据运用链表进行存储,同时用到指针变量,循环存储(三)功能模块详细设计3.1详细设计思想1、顺序表挂接链表的抽象定义类型:ADT sqmountlink 数据对象:D=aiaikindlist,i=1,2,,n,n=0 数据关系:R=ai-1,ai|ai1,aiD,i=1,2,3,,n 基本操作: InitMountLisr(L) 操作结果:构造一个空的顺序表挂接链表L。 Kind

3、Insert(&L,n) 初始条件:顺序表挂接链表L已存在。 操作结果:向顺序表挂接链表L中添加N类产品ProductInsert(L,I,n) 初始条件:顺序表挂接链表L已存在且要将产品插入的产品类i已存在 操作结果:向顺序表挂接链表L中的产品类i中添加N种产品ProQuantity_add(L,I,e,n) 初始条件:顺序表挂接链表L已存在且需要添加的产品及产品所属的类也存在 操作结果:添加顺序表挂接链表L的产品类i中的产品e的数量Visit(L,i,e) 初始条件:顺序表挂接链表L已存在且待查询的产品所属产品类i也存在 操作结果:在顺序表挂接链表L中查询产品e的各项信息DisplayLi

4、st(&L) 初始条件:顺序表挂接链表L已存在 操作结果:现实顺序表挂接链表L的内容3.2核心代码#includestdio。hincludeincludestring。hdefine ok 1define error 0define overflow 0#define SQMOUNTLINK_INIT_SIZE 100#define SQMOUNTLINKINCREMENT 10typedef struct date int year; int month; int day;date; /日期typedef struct productlnode char pname30; /产品名称 in

5、t totalquantity; /产品总量 date goodsdate; /进货日期 int salesquantity; /消除数量 date salestime; /销售时间 struct productlnode nextproduct;productlnode,*plinklist;typedef struct kindlnode productlnode firstproduct; char pkindname30;kindlnode;typedef struct kindlnode kindelem; int length; int listsize;sqmountlink;i

6、nt InitMountList(sqmountlink &L) /初始化一个空的顺序表挂接链表L int i; L.kindelem=(kindlnode)malloc(SQMOUNTLINK_INIT_SIZE*sizeof(kindlnode); if(!L。kindelem) exit(overflow); L。length=0; L.listsize=SQMOUNTLINK_INIT_SIZE; for(i=0;iL。listsize;i+) (L。kindelemi).firstproduct=NULL; return ok;/InitMountListint KindInsert

7、(sqmountlink &L,int n) /向顺序表挂接链表L中添加N类产品 int i; kindlnode newbase; if(L.length+n=L。listsize) newbase=(kindlnode)realloc(L.kindelem,(L.listsize+n)sizeof(kindlnode); if(!newbase) exit(overflow); L。kindelem=newbase; L。listsize+=n; printf(需添加的产品类名称:n”); for(i=0;in;i+) scanf(s”,L。kindelemL。length.pkindna

8、me); L。kindelemL.length。firstproduct=NULL; L.length+; return ok;/KindInsertint ProductInsert(sqmountlink L,char pkindname2,int n) /向顺序表挂接链表L的某产品类中添加N个产品 plinklist p,q; int k,j; for(k=0;ktotalquantity),&((qgoodsdate)。year),(qgoodsdate)。month),(qgoodsdate)。day),(qsalesquantity),&((q-salestime)。year),(

9、q-salestime).month),&(qsalestime)。day); qnextproduct=NULL; (L。kindelemk)。firstproduct=q; for(j=1;jtotalquantity),(p-goodsdate).year),(p-goodsdate)。month),&((pgoodsdate).day),&(p-salesquantity),((p-salestime).year),&(p-salestime)。month),((p-salestime).day); p-nextproduct=qnextproduct; q-nextproduct=p

10、; q=p; else for(q=L。kindelemk。firstproduct; ;q=qnextproduct) if(!(qnextproduct)) break; printf(”需添加产品的名称、总量、进货日期、销售数量、销售时间:n); for(j=0;jpname),(ptotalquantity),((pgoodsdate)。year),((pgoodsdate).month),&(p-goodsdate).day),&(psalesquantity),(p-salestime)。year),((p-salestime).month),(p-salestime)。day))

11、; pnextproduct=q-nextproduct; qnextproduct=p; q=p; return ok;/ProductInsertvoid ProQuantity_add(sqmountlink &L,char pkindname1,char pname1,int n) /添加顺序表挂接链表L的某产品类中的某产品的总量,且需添加的产品总量为n int i,k; plinklist p; for(i=0;inextproduct) k=strcmp(p-pname,pname1); if(k=0) ptotalquantity=ptotalquantity+n; printf

12、(”查看添加后产品的各项输出:s d d,d,%d d d,%d,dn,p-pname,p-totalquantity,(p-goodsdate).year,(p-goodsdate)。month,(p-goodsdate).day,psalesquantity,(psalestime)。year,(psalestime)。month,(psalestime).day); /ProQuantity_addvoid ProQuantity_subtract(sqmountlink L,char pkindname4,char pname4,int n) /添加顺序表挂接链表L的某产品类中的某产品

13、销出数量,且销出的数量n int i,k; plinklist p; for(i=0;iL.length;i+) if(strcmp(L。kindelemi)。pkindname,pkindname4)!=0) continue; else break; if(isalesquantity=psalesquantity+n; printf(查看添加后产品的各项输出:%s %d %d,d,%d %d d,%d,dn,p-pname,ptotalquantity,(p-goodsdate)。year,(pgoodsdate).month,(p-goodsdate).day,p-salesquant

14、ity,(psalestime).year,(p-salestime)。month,(psalestime)。day); /ProQuantity_subtractvoid Visit(sqmountlink L,char pkindname3,char pname3) /在顺序表挂接链表L中,查询属于某产品类的某产品的各项信息 int i,k; plinklist p; for(i=0;iL.length;i+) if(strcmp(L。kindelemi)。pkindname,pkindname3)!=0) continue; else break; if(iL。length) for(p

15、=L。kindelemi。firstproduct;p!=NULL;p=p-nextproduct) k=strcmp(p-pname,pname3); if(k=0) break; if(k!=0) printf(”此产品不存在:n”); else printf(”输出待查询产品的各项信息:n); printf(”产品类产 品产品总量进 货 日 期销售数量销 售 时 间n”); printf(”%s s %d d,d,%d d %d,%d,dn”,(L。kindelemi)。pkindname,p-pname,ptotalquantity,(pgoodsdate).year,(p-goods

16、date)。month,(p-goodsdate).day,psalesquantity,(psalestime).year,(p-salestime)。month,(psalestime).day); /Visitvoid DisplayList(sqmountlink &L) /显示各产品所属产品类、产品名称、产品总量、进货日期、销售数量、销售时间 int i; plinklist p; printf(”产品类产 品产品总量进 货 日 期销售数量销 售 时 间n”); for(i=0;iL.length;i+) if(!(L.kindelemi.firstproduct)) printf(

17、”sn”,(L。kindelemi)。pkindname); for(p=L.kindelemi.firstproduct;p;p=pnextproduct) printf(”s %s %d %d,d,%d d %d,d,dn,(L.kindelemi)。pkindname,ppname,ptotalquantity,(p-goodsdate)。year,(p-goodsdate)。month,(p-goodsdate)。day,p-salesquantity,(p-salestime)。year,(psalestime)。month,(psalestime).day); /DisplayLi

18、stvoid menu_operation()/操作菜单 printf(”n”); printf(输入所要执行的操作:n”); printf(”1、产品类添加: n”); printf(2、产品添加: n); printf(3、产品数量添加: n); printf(”4、产品售出: n); printf(5、查询产品: n”); printf(”0、退出程序: n”); printf(”n);/mene_operation/*-主程序-/void main(void) int order; int i,n; char a30; char b30; sqmountlink L; InitMoun

19、tList(L); printf(”输入时间时请按照“年,月,日”格式输入。n”); loop: menu_operation(); printf(输入命令:”); scanf(”d”,order); switch(order) case 1: printf(”需添加产品类的个数:); scanf(”%d,&i); KindInsert(L,i); printf(修改后的产品库存管理表:n); DisplayList(L); goto loop; case 2: printf(”需添加产品所属产品类的名称:”); scanf(”%s,a); printf(需向此产品类添加产品的个数:); sc

20、anf(d,i); ProductInsert(L,a,i); printf(修改后的产品库存管理表:n”); DisplayList(L); goto loop; case 3: printf(”输入需添加数量的产品所属产品类的名称:”); scanf(”s,&a); printf(输入需添加数量的产品的名称:”); scanf(”%s,b); printf(输入需添加产品的数量:”); scanf(”d”,&n); ProQuantity_add(L,a,b,n); printf(”修改后的产品库存管理表:n”); DisplayList(L); goto loop; case 4: pr

21、intf(”输入售出产品所属产品类的名称:); scanf(”%s,a); printf(”输入售出产品的名称:”); scanf(s,b); printf(输入售出产品的数量:); scanf(d”,&n); ProQuantity_subtract(L,a,b,n); printf(”修改后的产品库存管理表:n); DisplayList(L); goto loop; case 5: printf(输入待查询产品所属产品类的名称:”); scanf(”s,a); printf(”输入待查询产品的名称:”); scanf(s”,b); Visit(L,a,b); goto loop; cas

22、e 0: exit(0); 3。3程序运行结果 程序启动界面。产品类的添加。产品的添加。产品数量的添加.产品售出.产品查询。(四) 课程设计心得,存在问题及解决方法 拿到这道题时,我没有选择自己去编写,我想我从来没有编过这么复杂的程序,一定编不成,我选择了上网去查,值得庆幸的是我找到了一部分的程序,然后拷贝上程序在机房运行,发现有许多错误,我就开始一个一个解决问题,其中有些问题是一些符号的丢失,还有头文件的错误运用,还有对一些输入超出程序范围的数据进行修改,才使程序得以继续进行,最后我通过自己和请教同学,最终整个程序得以运行,不过最重要的不是仅仅让程序运行成功,而是了解整个程序的思想设计和功能的实现,然后我开始翻译程序,把每一句都弄的清清楚楚为止,从中我复习了很多知识点,也学到了很多我以前不知道的东西。通过对本系统的开发,我对软件开发过程有了更清楚地了解,首先是问题的定义,需求分析,然后概要设计,详细设计等,让我知道了仅仅学习课本知识是不行的,还得经常去自己设计一些小的项目去发现问题,必须培养动手能力,这样才能既复习了知识点,又可以学会详细的数据结构思想和设计,所以我在以后一定要加强这方面的学习。 13

展开阅读全文
相似文档                                   自信AI助手自信AI助手
猜你喜欢                                   自信AI导航自信AI导航
搜索标签

当前位置:首页 > 学术论文 > 其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服