1、商品销售管理系统736071doc商品销售管理系统736071#include#include#include/#includeFILE.htypedef struct shangpinchar name20;int biaohao;int shuliang;double jiage;Node;typedef struct listNode data;struct list *next;List,*Slist;void char u(Slist &s,Node x);int caidan()int i;while(1);system(cls);printf(nttt 商店销售管理系统nn);p
2、rintf(tt *nn); printf(tt 1-添加商品 2-出售商品nn);printf(tt 3-删除商品 4-显示商品nn);printf(tt 5-查找商品 0-退出系统nn);printf(tt *nn); printf(请选择(0-5):);scanf(%d,&i);if(i=0)break;return ivoid chushihua(Slist &s)Slist head=new Listhead-next=NULL;S=head;void tianjia(Slist &s)Node x;Slist r,p,q;int i=0;r=new List;r-next=NULL
3、;q=p=s-next;while(q)i+;q=q-next;printf(请输入商品名称,数量以及价格:);scanf(%s%d%lf,x.name,&x.shuliang,&x.jiage);x.biaohao=i+1;r-data=x;s-next=r;r-next=p;void duchu(Slist &s)FILE*cp;int i=0;Node x;if(cp=fopen(shangpin.txt,a+)=NULL)fseek(cp,0L,SEEK.SET);while(!feof(cp)fscanf(cp,%s%d%lf,x.name,&x.shuliang,&x.jiage)
4、; x.biaohao=+i;char u(s,x);fclose(cp);void char u(Slist &s,Node x)Slist r,p=s-next;r=new List;r-next=NULL;r-data=x;s-next=r;r-next=p;void xieru(Slist s)FILE*cp;Slist p=s-next;if(cp=fopen(shangpin.txt,w+)=NULL)WHILE(p)fprintf(cp,%s %d %2lf,p-data.jiage);p=p-next;fclose(cp);slist chazhao(Slist s,int m
5、)Slist p=s-next;if(p=0)return 0;if(p-next=0)return p;if(p-data.biaohao=m)return p;while(p-next)if(p-next-data.biaohao=m)return p;p=p-next;return 0;void xianshi(Slist s)Slist p;p=s-next;printf(%10s%20s%10s%10sn,商品编号,商品名称,商品数量,商品价格); while(p)printf(%10d%20s%10d%10.2fn,p-data.biaohao,p-data.name,p-data
6、.shuliang,p- data.jiage);p=p-next;void shanchu(Slist &s)void chushou(Slist &s)void main()int sum;Slist s;chushihua(s);duchu(s);num=caidan();while(1)switch(num);case 0:exit(0);break;case 1:tianjia(s);break;case 2:chushou(s);break;case 3:shanchu(s);break;case 4:xianshi(s);break;case 5:chazhao(s,1);bre
7、ak;printf(按任意键继续);getch();num=caidanxieru(s);#include stdio.h/*输入输出函数*/#include stdlib.h/*通用应用程序函数*/#include string.h/*字符串函数*/#include ctype.h/*字符操作函数*/typedef struct /*定义结构体变量*/int name;int a1;int a2;int a3;int a4;int a5;RECODE;int menu_select();/*声明函数*/int enter(RECODE t);/*声明函数*/void salor(RECODE
8、 t,int n);/*声明函数*/int sum(RECODE t,int n,int m);/*声明函数*/void list1(RECODE t,int n);/*声明函数*/void list2(RECODE t,int n);/*声明函数*/void list3(RECODE t,int n);/*声明函数*/void save(RECODE t,int n);/*声明函数*/int load(RECODE t);/*声明函数*/main()/*主函数*/RECODE rec600;int length;system(cls); /*清屏*/for( ; ; ) /*无限循环*/switch(menu_select() /*根据用户的选择判断该调用哪个功能函数*/ case 1:length=enter(rec);break;case 2:salor(rec,length);break;case 3:list1(rec,length);break;case 4:list2(rec,length);break;case 5:list3(rec,length);break;case 6:save(rec,length);break;case 7:length=load(rec);break;case 0:exit(0);
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1