C语言--仓库管理系统002

上传人:博****1 文档编号:507661050 上传时间:2022-09-17 格式:DOC 页数:21 大小:30KB
返回 下载 相关 举报
C语言--仓库管理系统002_第1页
第1页 / 共21页
C语言--仓库管理系统002_第2页
第2页 / 共21页
C语言--仓库管理系统002_第3页
第3页 / 共21页
C语言--仓库管理系统002_第4页
第4页 / 共21页
C语言--仓库管理系统002_第5页
第5页 / 共21页
点击查看更多>>
资源描述

《C语言--仓库管理系统002》由会员分享,可在线阅读,更多相关《C语言--仓库管理系统002(21页珍藏版)》请在金锄头文库上搜索。

1、.#include#include#includetypedefstructintno;charname5;intnumber;Data;typedefstructnodeDatainform;structnode*next;LNode,*LinkList;voidOnit_LinkList(LinkListL);LinkListCreat_LinkList(LinkListL);voidPrint_LinkList(LNode*L);LinkListSearch_Data(intNo,LinkListL);LinkListIn_Data(Datad,LinkListL);voidOut_Da

2、ta(intNo,intnumber,LinkListL);LinkListSort_LinkList(LinkListL);LNode*Compare_NO(LinkListL);LNode*Mix(LinkListL);intmain()intoption;LNode*L;L=(LNode*)malloc(sizeof(LNode);Onit_LinkList(L);docoutn-请选择相应的操作-n1.录入货物信息endl2.查找货物并输出相应信息endl3.加入货物endl4.提取货物endl5.输出货物信息endl0.退出仓库管理系统option;switch(option)cas

3、e0:break;case1:L=Creat_LinkList(L);break;case2:intn1;LinkListL1;L1=(LNode*)malloc(sizeof(LNode);coutn键入0退出查找。n;docoutn1;if(n1=0)break;L1=Search_Data(n1,L);if(L1=NULL)coutn找不到指定的货物!n;elsecout-n货物代号setw(15)货物名称setw(15)货物数量endlinform.nosetw(18)inform.namesetw(18)inform.numberendl;while(n1);break;case3:

4、LinkListL1;L1=(LNode*)malloc(sizeof(LNode);cout键入0退出加入货物。n;doDatad;coutd.no;L1=Search_Data(d.no,L);if(d.no=0)break;if(L1!=NULL)coutn仓库中已存在要加入的货物,nd.number;elsecoutd.named.number;L=In_Data(d,L);while(1);break;case4:LinkListL1;L1=(LNode*)malloc(sizeof(LNode);coutn键入0退出提取货物。n;dointNo,number;coutNo;if(N

5、o=0)break;L1=Search_Data(No,L);if(L1=NULL)cout该货物信息不存在!n;continue;cout-n货物代号setw(15)货物名称setw(15)货物数量endlinform.nosetw(18)inform.namesetw(18)inform.numberendl;coutnumber;Out_Data(No,number,L);while(1);break;case5:Print_LinkList(L);break;default:coutnext=NULL;LinkListCreat_LinkList(LinkListL)LNode*s,*

6、r=L;cout键入0退出录入。n;docouts-inform.no;if(s-inform.no=0)free(s);break;if(r-inform.no=s-inform.no)coutn货号重复!n;continue;couts-inform.names-inform.number;r-next=s;r=s;while(1);if(r!=NULL)r-next=NULL;L=Sort_LinkList(L);returnL;voidPrint_LinkList(LNode*L)LNode*r=L;if(L-next=NULL)cout仓库中无货物n;elsecout-n货物代号se

7、tw(15)货物名称setw(15)货物数量next;coutinform.nosetw(18)inform.namesetw(18)inform.numbernext!=NULL);LinkListSearch_Data(intNo,LinkListL)LinkListr;r=L-next;while(r!=NULL&r-inform.no!=No)r=r-next;returnr;LinkListIn_Data(Datad,LinkListL)LinkListL1;L1=(LNode*)malloc(sizeof(LNode);L1=Search_Data(d.no,L);if(L1=NU

8、LL)LNode*r,*p,*s;r=L-next;s=L;p=(LNode*)malloc(sizeof(LNode);p-inform.no=d.no;for(inti=0;iinform.namei=d.namei;p-inform.number=d.number;while(r-inform.nonext;while(s-next!=r)s=s-next;p-next=s-next;s-next=p;elseL1-inform.number+=d.number;returnL;LinkListSort_LinkList(LinkListL)LinkListnew_list;LNode*

9、r,*p,*mix;new_list=(LNode*)malloc(sizeof(LNode);new_list-next=NULL;r=new_list;mix=Mix(L);dop=(LNode*)malloc(sizeof(LNode);p=Compare_NO(L);r-next=p;r=p;while(p-inform.noinform.no);if(r!=NULL)r-next=NULL;L=new_list;returnL;voidOut_Data(intNo,intnumber,LinkListL)LinkListL1;L1=(LNode*)malloc(sizeof(LNod

10、e);L1=Search_Data(No,L);if(L1-inform.number=number)L1-inform.number-=number;elsecharp;coutp;if(p=y|p=Y)coutn货物inform.nameendl提取了inform.number件,还需inform.number件才能满足您的要求inform.number=0;LNode*Compare_NO(LinkListL)LNode*r,*p,*s;s=(LNode*)malloc(sizeof(LNode);p=L-next;if(p-next=NULL)returnp;r=p-next;while(r!=NULL)if(p-inform.nor-inform.no)p=r;r=r-next;*s=*p;while(L-next!=p)L=L-next;if(p-next=NULL)L-next=NULL;elseL-next=p-next;free(p);returns;LNode*Mix(LinkListL)LNode*r,*p,*s;s=(LNode*)malloc(sizeof(LNode);p=L-next;if(p-next=NULL)returnp;r=p-next;while(r!=NULL)if(p-inform.noinfor

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 高等教育 > 研究生课件

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号