




已阅读5页,还剩30页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
超市仓库管理系统程序如下:#include #include#include #include #include仓库管理系统.h#define N 500#define LEN sizeof(struct product)#define ILEN sizeof(struct in_product)#define OLEN sizeof(struct out_product)#define QLEN sizeof(struct quit_product)void init() head=NULL; qhead=NULL; ihead=NULL; ohead=NULL; printf(ttn); printf(tt n); printf(tt n); printf(tt n); printf(tt * n); printf(tt * * n); printf(tt * 欢迎进入 * n); printf(tt * * n); printf(tt * 超市仓库管理系统 * n); printf(tt * * n); printf(tt * n); printf(tt n); printf(tt n); printf(tt n); printf(ttnn); printf(tttt 1: 入库管理n); printf(tttt 2: 出库管理n); printf(tttt 3: 退货管理n); printf(tttt 4: 商品统计n); printf(tttt 0: 退出系统n); void menu() printf(tttt 1: 添加数据n); printf(tttt 2: 删除数据n); printf(tttt 3: 修改数据n); printf(tttt 4: 查看数据n); printf(tttt其它: 退回上一级菜单n); void menu2() printf(ttn); printf(tt n); printf(tt n); printf(tt n); printf(tt * n); printf(tt * * n); printf(tt * 欢迎进入 * n); printf(tt * * n); printf(tt * 超市仓库管理系统 * n); printf(tt * * n); printf(tt * n); printf(tt n); printf(tt n); printf(tt n); printf(ttnn); printf(tttt 1: 入库管理n); printf(tttt 2: 出库管理n); printf(tttt 3: 退货管理n); printf(tttt 4: 商品统计n); printf(tttt 0: 退出系统n); printf(ntttt输入错误,请重新输入!n); int Rkjl() /入库信息录入文件 struct in_product pN,s; int i=0,j,n; FILE *pf,*pf1; pf=fopen(入库信息记录.dat,rb+); pf1=fopen(入库信息记录.xls,r+); /printf(入库编号 商品编号 入库商品名 入库数量 入库价格 总价n); for(i=0;fread(&pi,ILEN,1,pf)!=NULL;i+); / printf(%ldt%st%st%dt%dt%dn,pi.num,pi.p_num,,pi.amount,pi.price,pi.t_price); for(j=0;ji;j+) for(n=0;npn+1.num)/入库编号小的先录入 s=pn;pn=pn+1;pn+1=s;rewind(pf);fseek(pf1,56L,0); for(j=0;ji;j+) fwrite(&pj,ILEN,1,pf); fprintf(pf1,%ldt%st%st%dt%dt%dn,pj.num,pj.p_num,,pj.amount,pj.price,pj.t_price); fclose(pf); fclose(pf1);return 0;int Ckjl() /出库信息录入文件 struct out_product pN,s; int i,j,n; FILE *pf,*pf1; pf=fopen(出库信息记录.dat,rb+); pf1=fopen(出库信息记录.xls,r+); /printf(出库编号 商品编号 出库商品名 出库数量 出库价格 总 价n); for(i=0;fread(&pi,OLEN,1,pf)!=NULL;i+); / printf(%ldt%st%st%dt%dt%dn,pi.num,pi.p_num,,pi.amount,pi.price,pi.t_price); for(j=0;ji;j+) for(n=0;npn+1.num)/出库编号小的先录入 s=pn;pn=pn+1;pn+1=s;rewind(pf);fseek(pf1,56L,0); for(j=0;ji;j+) fwrite(&pj,OLEN,1,pf); fprintf(pf1,%ldt%st%st%dt%dt%dn,pj.num,pj.p_num,,pj.amount,pj.price,pj.t_price); fclose(pf); fclose(pf1);return 0;int Thjl() /退货信息录入文件 struct quit_product pN,s; int i,j,n; FILE *pf,*pf1; pf=fopen(退货信息记录.dat,rb+); pf1=fopen(退货信息记录.xls,r+); for(i=0;fread(&pi,QLEN,1,pf)!=NULL;i+); for(j=0;ji;j+) for(n=0;npn+1.num)/退货编号小的先录入 s=pn;pn=pn+1;pn+1=s;rewind(pf);fseek(pf1,56L,0); for(j=0;jp_num); printf(n商品名:); scanf(%s,&p1-name); printf(n型号/规格:); scanf(%s,&p1-spec); printf(n商品数量:); scanf(%d,&p1-amount); printf(n进货价:); scanf(%d,&p1-price); printf(n销售价:); scanf(%d,&p1-s_price);fprintf(pf,%st%st%st%dt%dt%dn,p1-p_num,p1-name,p1-spec,p1-amount,p1-price,p1-s_price);fclose(pf);head=p1; head-next=NULL; return 0; while(p-next!=NULL)/把指针移到链表末端,在链表末端插入数据 p=p-next; p-next=p1; printf(n下列数据将录入商品信息记录文件中!n); printf(n商品编号:); scanf(%s,&p1-p_num); printf(n商品名:); scanf(%s,&p1-name); printf(n型号/规格:); scanf(%s,&p1-spec); printf(n商品数量:); scanf(%d,&p1-amount); printf(n进货价:); scanf(%d,&p1-price); printf(n销售价:); scanf(%d,&p1-s_price);fprintf(pf,%st%st%st%dt%dt%dn,p1-p_num,p1-name,p1-spec,p1-amount,p1-price,p1-s_price);fclose(pf);p1-next=NULL;return 0; int in_insert() /添加入库数据 struct in_product *p1,*p2; int n=0;char c5; FILE *pf; system(cls);pf=fopen(入库信息记录.dat,ab+); p1=p2=(struct in_product *)malloc(ILEN); printf(ttt*输入入库商品信息*n); printf(n下列数据将录入入库信息记录文件中!n); printf(n入库编号:);scanf(%ld,&p1-num);printf(n商品编号:);scanf(%s,&p1-p_num);printf(n入库商品名:);scanf(%s,&p1-name);printf(n入库数量:);scanf(%d,&p1-amount);printf(n入库价格:);scanf(%d,&p1-price);p1-t_price=p1-amount*p1-price;printf(n总价:);printf(%dn,p1-t_price);fwrite(p1,ILEN,1,pf); insert_product();ihead=NULL;while(1) n=n+1;if(n=1) ihead=p1;else p2-next=p1;p2=p1;p1=(struct in_product *)malloc(ILEN); while(1) printf(n退出输入请按Y/y键,任意键继续:); scanf(%s,c); if(strcmp(c,y)=0|strcmp(c,Y)=0) fclose(pf); p2-next=NULL; return 0;else break; printf(n下列数据将录入入库信息记录文件中!n); printf(n入库编号:);scanf(%ld,&p1-num);printf(n商品编号:);scanf(%s,&p1-p_num);printf(n入库商品名:);scanf(%s,&p1-name);printf(n入库数量:);scanf(%d,&p1-amount);printf(n入库价格:);scanf(%d,&p1-price);p1-t_price=p1-amount*p1-price;printf(n总价:);printf(%dn,p1-t_price); fwrite(p1,ILEN,1,pf); insert_product(); fclose(pf);p2-next=NULL;return 0; int in_modify() /修改入库数据 system(cls);long m_num; FILE *fp,*fp1;int i,j,n;int t=3;struct in_product xgN; fp=fopen(入库信息记录.dat,rb+); fp1=fopen(入库信息记录.xls,r+); printf(入库编号 商品编号 入库商品名 入库数量 入库价格 总 价n); printf(-n);for(i=0;fread(&xgi,ILEN,1,fp)!=NULL;i+)printf( %-8ld %-8s %-10s %-8d %-8d %-8dn, xgi.num,xgi.p_num,,xgi.amount,xgi.price,xgi.t_price); printf(-n); printf(输入要修改的商品的入库编号:);IXG: scanf(%ld,&m_num); j=0;while(ji) if(xgj.num=m_num) printf(ttt输入新的入库商品信息!n); printf(n商品编号:);scanf(%s,&xgj.p_num);printf(n入库商品名:);scanf(%s,&);printf(n入库数量:);scanf(%d,&xgj.amount);printf(n入库价格:);scanf(%d,&xgj.price);xgj.t_price=xgj.amount*xgj.price;printf(n总价:);printf(%dn,xgj.t_price); printf(ttt商品信息修改成功!n); printf(入库编号 商品编号 入库商品名 入库数量 入库价格 总 价n); printf( %-8ld %-8s %-10s %-8d %-8d %-8dn, xgj.num,xgj.p_num,,xgj.amount,xgj.price,xgj.t_price); rewind(fp);fseek(fp1,56L,0);for(n=0;ni;n+) fwrite(&xgn,ILEN,1,fp); fprintf(fp1,%ldt%st%st%dt%dt%dn,xgn.num,xgn.p_num,,xgn.amount,xgn.price,xgn.t_price);fclose(fp);fclose(fp1);printf(按回车键退回上一级菜单.); getchar();getchar(); return 0; j+; t-; if(t=0) return 0; printf(n没有找到该入库编号,请重新输入,还有%d次机会:,t); goto IXG;int in_select() /查询入库数据system(cls);FILE *fp;int i,j;int t=3;long s_num; struct in_product cxN; if(fp=fopen(入库信息记录.dat,rb)=NULL)printf(can not open filen); exit(0); printf(ttt-n);printf(ttt入库货物统计如下n);printf(ttt-nn);printf(入库编号 商品编号 入库商品名 入库数量 入库价格 总 价n);printf(-n); for(i=0;fread(&cxi,ILEN,1,fp)!=NULL;i+) printf( %-8ld %-8s %-10s %-8d %-8d %-8dn, cxi.num,cxi.p_num,,cxi.amount,cxi.price,cxi.t_price); printf(-n); fclose(fp);printf(输入要查询的入库编号:); ICX:scanf(%ld,&s_num); j=0;while(ji) if(cxj.num=s_num) printf(n查询结果如下:nn); printf(入库编号 商品编号 入库商品名 入库数量 入库价格 总 价n);printf( %-8ld %-8s %-10s %-8d %-8d %-8dn, cxj.num,cxj.p_num,,cxj.amount,cxj.price,cxj.t_price); printf(按回车键退回上一级菜单.); getchar();getchar(); return 0; j+; t-;if(t=0) return 0; printf(n没有找到该入库编号,还有%d次机会,请重新输入:,t); goto ICX; int in_delete() /删除入库数据,若所要取出的商品数量小于商品总数量,则是商品总数减少/若取出所有商品数量,则删除那一行数据 system(cls);int i,n,j;int t=3;int s; long d_num; struct in_product scN; FILE *fp,*fp1; fp=fopen(入库信息记录.dat,rb+); for(i=0;fread(&sci,ILEN,1,fp)!=NULL;i+); printf(输入要取出的商品的入库编号:); ISC:scanf(%ld,&d_num);printf(n 输入要取出的商品的数量:); scanf(%d,&s);j=0; while(ji) if(scj.num=d_num) fp=fopen(入库信息记录.dat,wb+); fp1=fopen(入库信息记录.xls,w); fprintf(fp1,%st%st%st%st%st%sn,入库编号,商品编号,入库商品名,入库数量,入库价格,总 价); if(scj.amount-s)=0) for(n=j;ni-1;n+) scn=scn+1; fseek(fp1,56L,0); for(n=0;n0)scj.amount-=s;fseek(fp1,56L,0);for(n=0;nnum);printf(n商品编号:);scanf(%s,&p1-p_num);printf(n出库商品名:);scanf(%s,&p1-name);printf(n出库数量:);scanf(%d,&p1-amount);printf(n出库价格:);scanf(%d,&p1-price);p1-t_price=p1-amount*p1-price;printf(n总价:);printf(%dn,p1-t_price); fwrite(p1,OLEN,1,pf); ohead=NULL; while(1) n=n+1; if(n=1) ohead=p1; else p2-next=p1; p2=p1; p1=(struct out_product *)malloc(OLEN); while(1) printf(退出输入请按Y/y键,任意键继续:); scanf(%s,c); if(strcmp(c,y)=0|strcmp(c,Y)=0) fclose(pf); p2-next=NULL; return 0;else break; printf(n出库编号:);scanf(%ld,&p1-num);printf(n商品编号:);scanf(%s,&p1-p_num);printf(n出库商品名:);scanf(%s,&p1-name);printf(n出库数量:);scanf(%d,&p1-amount);printf(n出库价格:);scanf(%d,&p1-price);p1-t_price=p1-amount*p1-price;printf(n总价:);printf(%dn,p1-t_price); fwrite(p1,OLEN,1,pf); fclose(pf); p2-next=NULL; return 0; int out_modify()/修改出库数据/相当于更新“出库信息记录”中的内容 system(cls); long m_num; FILE *fp,*fp1; int i,j,n;int t=3; struct out_product xgN; fp=fopen(出库信息记录.dat,rb+); fp1=fopen(出库信息记录.xls,r+); printf(出库编号 商品编号 出库商品名 出库数量 出库价格 总 价n);printf(-n);for(i=0;fread(&xgi,OLEN,1,fp)!=NULL;i+) printf( %-8ld %-8s %-10s %-8d %-8d %-8dn, xgi.num,xgi.p_num,,xgi.amount,xgi.price,xgi.t_price); printf(-n); printf(输入要修改的商品的出库编号:);OXG: scanf(%ld,&m_num); j=0; while(ji) if(xgj.num=m_num) printf(nttt输入新的出库商品信息!n); printf(n商品编号:);scanf(%s,&xgj.p_num);printf(n出库商品名:);scanf(%s,&);printf(n出库数量:);scanf(%d,&xgj.amount);printf(n出库价格:);scanf(%d,&xgj.price);xgj.t_price=xgj.price*xgj.amount;printf(n总价:);printf(%dn,xgj.t_price); printf(ttt商品信息修改成功!n); printf(出库编号 商品编号 出库商品名 出库数量 出库价格 总 价n);printf( %-8ld %-8s %-10s %-8d %-8d %-8dn, xgj.num,xgj.p_num,,xgj.amount,xgj.price,xgj.t_price);rewind(fp);fseek(fp1,56L,0); for(n=0;ni;n+) fwrite(&xgn,OLEN,1,fp);fprintf(fp1,%ldt%st%st%dt%dt%dn,xgn.num,xgn.p_num,,xgn.amount,xgn.price,xgn.t_price); fclose(fp); fclose(fp1); printf(按回车键退回上一级菜单.); getchar();getchar(); return 0; j+; t-; if(t=0) return 0; printf(n没有找到该出库编号,还有%d次机会,请重新输入:,t); goto OXG; int out_select() /查询出库数据 system(cls);FILE *fp; int i,j;int t=3; long s_num; struct out_product cxN; if(fp=fopen(出库信息记录.dat,rb)=NULL)printf(can not open filen); exit(0); printf(ttt-n);printf(ttt出库货物统计
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 汽车等级考试试题及答案
- 海南省卫生健康委员会2025年医师资格考试中医执业助理医师练习题及答案
- 2025年公路工程试验检测师资格考试(公共基础)综合能力测试题及答案(广东汕尾)
- 遗体接运工前沿技术考核试卷及答案
- 玻璃钢制品缠绕工设备维护与保养考核试卷及答案
- 电商咨询师技术考核试卷及答案
- 2025年广东省职业病诊断医师考试职业性尘肺病及其他呼吸系统疾病复习题及答案
- 2025年茂名职业病诊断医师考试(职业性尘肺病)复习题及答案
- 2025年工匠试题考核及答案
- 2025年枣庄东林农文化产业发展有限公司招聘工作人员考试真题含答案
- 第2课《中国人首次进入自己的空间站》教学设计-统编版语文八年级上册
- 牛羊肉供货合同模板2025年
- 23G409先张法预应力混凝土管桩
- 民航安全检查员(四级)理论考试题库(浓缩500题)
- 热力管网监理实施细则
- FMEA-潜在失效模式分析
- 统编版高中语文选择性必修上册第一单元测试卷【含答案】
- 保健食品注册与备案管理办法课件
- 钢筋锈蚀原理及应对措施案例分析(54页图文丰富)
- 第二讲水轮机结构
- K2FastWave中文操作手册
评论
0/150
提交评论