超市倉(cāng)庫(kù)管理系統(tǒng)-程序_第1頁(yè)
超市倉(cāng)庫(kù)管理系統(tǒng)-程序_第2頁(yè)
超市倉(cāng)庫(kù)管理系統(tǒng)-程序_第3頁(yè)
超市倉(cāng)庫(kù)管理系統(tǒng)-程序_第4頁(yè)
超市倉(cāng)庫(kù)管理系統(tǒng)-程序_第5頁(yè)
已閱讀5頁(yè),還剩60頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、超市倉(cāng)庫(kù)管理系統(tǒng)程序如下:#include #include#include #include #include倉(cāng)庫(kù)管理系統(tǒng).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);

2、printf(ttn); printf(ttn); printf(ttn); printf(tt * n); printf(tt * * n); printf(tt * 歡迎進(jìn)入 * n); printf(tt * * n); printf(tt * 超市倉(cāng)庫(kù)管理系統(tǒng) * n); printf(tt * * n); printf(tt * n); printf(ttn); printf(ttn); printf(ttn); printf(ttnn); printf(tttt 1: 入庫(kù)管理n); printf(tttt 2: 出庫(kù)管理n); printf(tttt 3: 退貨管理n); pri

3、ntf(tttt 4: 商品統(tǒng)計(jì)n); printf(tttt 0: 退出系統(tǒng)n); void menu() printf(tttt 1: 添加數(shù)據(jù)n); printf(tttt 2: 刪除數(shù)據(jù)n); printf(tttt 3: 修改數(shù)據(jù)n); printf(tttt 4: 查看數(shù)據(jù)n); printf(tttt其它: 退回上一級(jí)菜單n); void menu2() printf(ttn); printf(ttn); printf(ttn); printf(ttn); printf(tt * n); printf(tt * * n); printf(tt * 歡迎進(jìn)入 * n); print

4、f(tt * * n); printf(tt * 超市倉(cāng)庫(kù)管理系統(tǒng) * n); printf(tt * * n); printf(tt * n); printf(ttn); printf(ttn); printf(ttn); printf(ttnn); printf(tttt 1: 入庫(kù)管理n); printf(tttt 2: 出庫(kù)管理n); printf(tttt 3: 退貨管理n); printf(tttt 4: 商品統(tǒng)計(jì)n); printf(tttt 0: 退出系統(tǒng)n); printf(ntttt輸入錯(cuò)誤,請(qǐng)重新輸入!n); int Rkjl() /入庫(kù)信息錄入文件 struct in_

5、product pN,s; int i=0,j,n; FILE *pf,*pf1; pf=fopen(入庫(kù)信息記錄.dat,rb+); pf1=fopen(入庫(kù)信息記錄.xls,r+); /printf(入庫(kù)編號(hào) 商品編號(hào) 入庫(kù)商品名 入庫(kù)數(shù)量 入庫(kù)價(jià)格 總價(jià)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)/入庫(kù)編號(hào)小的先

6、錄入 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() /出庫(kù)信息錄入文件 struct out_product pN,s; int i,j,n; FILE *pf,*pf1; pf=fopen(出庫(kù)信息記錄.d

7、at,rb+); pf1=fopen(出庫(kù)信息記錄.xls,r+); /printf(出庫(kù)編號(hào) 商品編號(hào) 出庫(kù)商品名 出庫(kù)數(shù)量 出庫(kù)價(jià)格 總 價(jià)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)/出庫(kù)編號(hào)小的先錄入 s=pn;pn=pn+1;pn+1=s;rewind(pf);fseek(pf1,56L,0); for(j=

8、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

9、,1,pf)!=NULL;i+);for(j=0;ji;j+) for(n=0;npn+1.num)/退貨編號(hào)小的先錄入 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型號(hào)/規(guī)格:); scanf(%s,&p1-spec); printf(n商品數(shù)量:); scanf(%d,&p1-amount); printf(n進(jìn)貨價(jià):); scanf(%d,&p1-price); printf(n銷(xiāo)售價(jià):); scanf(%d,&p1

10、-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)/把指針移到鏈表末端,在鏈表末端插入數(shù)據(jù) p=p-next; p-next=p1; printf(n下列數(shù)據(jù)將錄入商品信息記錄文件中!n); printf(n商品編號(hào):); scanf(%s,&p1-p_num); printf(n商品名:); scanf(%s,&p1-nam

11、e); printf(n型號(hào)/規(guī)格:); scanf(%s,&p1-spec); printf(n商品數(shù)量:); scanf(%d,&p1-amount); printf(n進(jìn)貨價(jià):); scanf(%d,&p1-price); printf(n銷(xiāo)售價(jià):); 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() /添加入庫(kù)數(shù)據(jù) stru

12、ct in_product *p1,*p2; int n=0;char c5; FILE *pf; system(cls);pf=fopen(入庫(kù)信息記錄.dat,ab+); p1=p2=(struct in_product *)malloc(ILEN); printf(ttt*輸入入庫(kù)商品信息*n); printf(n下列數(shù)據(jù)將錄入入庫(kù)信息記錄文件中!n);printf(n入庫(kù)編號(hào):);scanf(%ld,&p1-num);printf(n商品編號(hào):);scanf(%s,&p1-p_num);printf(n入庫(kù)商品名:);scanf(%s,&p1-name);printf(n入庫(kù)數(shù)量:);

13、scanf(%d,&p1-amount);printf(n入庫(kù)價(jià)格:);scanf(%d,&p1-price);p1-t_price=p1-amount*p1-price;printf(n總價(jià):);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退出輸入請(qǐng)按Y/y鍵,任意鍵繼續(xù):);

14、 scanf(%s,c); if(strcmp(c,y)=0|strcmp(c,Y)=0) fclose(pf); p2-next=NULL; return 0;else break; printf(n下列數(shù)據(jù)將錄入入庫(kù)信息記錄文件中!n);printf(n入庫(kù)編號(hào):);scanf(%ld,&p1-num);printf(n商品編號(hào):);scanf(%s,&p1-p_num);printf(n入庫(kù)商品名:);scanf(%s,&p1-name);printf(n入庫(kù)數(shù)量:);scanf(%d,&p1-amount);printf(n入庫(kù)價(jià)格:);scanf(%d,&p1-price);p1-t

15、_price=p1-amount*p1-price;printf(n總價(jià):);printf(%dn,p1-t_price);fwrite(p1,ILEN,1,pf); insert_product();fclose(pf);p2-next=NULL;return 0;int in_modify() /修改入庫(kù)數(shù)據(jù) system(cls);long m_num; FILE *fp,*fp1;int i,j,n;int t=3;struct in_product xgN; fp=fopen(入庫(kù)信息記錄.dat,rb+); fp1=fopen(入庫(kù)信息記錄.xls,r+);printf(入庫(kù)編號(hào)

16、商品編號(hào) 入庫(kù)商品名 入庫(kù)數(shù)量 入庫(kù)價(jià)格 總 價(jià)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(輸入要修改的商品的入庫(kù)編號(hào):);IXG: scanf(%ld,&m_num); j=0;while(ji) if(xgj.num=m_num) printf(ttt輸入新的入庫(kù)商品信息!n);pri

17、ntf(n商品編號(hào):);scanf(%s,&xgj.p_num);printf(n入庫(kù)商品名:);scanf(%s,&);printf(n入庫(kù)數(shù)量:);scanf(%d,&xgj.amount);printf(n入庫(kù)價(jià)格:);scanf(%d,&xgj.price);xgj.t_price=xgj.amount*xgj.price;printf(n總價(jià):);printf(%dn,xgj.t_price);printf(ttt商品信息修改成功!n); printf(入庫(kù)編號(hào) 商品編號(hào) 入庫(kù)商品名 入庫(kù)數(shù)量 入庫(kù)價(jià)格 總 價(jià)n);printf( %-8ld %-8s %-10s %

18、-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(按回車(chē)鍵退回上一級(jí)菜單.);getchar();getchar();

19、 return 0; j+; t-; if(t=0) return 0; printf(n沒(méi)有找到該入庫(kù)編號(hào),請(qǐng)重新輸入,還有%d次機(jī)會(huì):,t); goto IXG;int in_select() /查詢?nèi)霂?kù)數(shù)據(jù)system(cls);FILE *fp;int i,j;int t=3;long s_num; struct in_product cxN; if(fp=fopen(入庫(kù)信息記錄.dat,rb)=NULL)printf(can not open filen); exit(0); printf(ttt-n);printf(ttt入庫(kù)貨物統(tǒng)計(jì)如下n);printf(ttt-nn);pri

20、ntf(入庫(kù)編號(hào) 商品編號(hào) 入庫(kù)商品名 入庫(kù)數(shù)量 入庫(kù)價(jià)格 總 價(jià)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(輸入要查詢的入庫(kù)編號(hào):); ICX:scanf(%ld,&s_num); j=0;while(ji) if(cxj.num=s_num) printf(n查詢

21、結(jié)果如下:nn); printf(入庫(kù)編號(hào) 商品編號(hào) 入庫(kù)商品名 入庫(kù)數(shù)量 入庫(kù)價(jià)格 總 價(jià)n);printf( %-8ld %-8s %-10s %-8d %-8d %-8dn, cxj.num,cxj.p_num,,cxj.amount,cxj.price,cxj.t_price);printf(按回車(chē)鍵退回上一級(jí)菜單.);getchar();getchar(); return 0; j+; t-;if(t=0) return 0; printf(n沒(méi)有找到該入庫(kù)編號(hào),還有%d次機(jī)會(huì),請(qǐng)重新輸入:,t); goto ICX; int in_delete() /刪除入庫(kù)數(shù)據(jù),

22、若所要取出的商品數(shù)量小于商品總數(shù)量,則是商品總數(shù)減少/若取出所有商品數(shù)量,則刪除那一行數(shù)據(jù) system(cls);int i,n,j;int t=3;int s; long d_num; struct in_product scN; FILE *fp,*fp1;fp=fopen(入庫(kù)信息記錄.dat,rb+); for(i=0;fread(&sci,ILEN,1,fp)!=NULL;i+); printf(輸入要取出的商品的入庫(kù)編號(hào):); ISC:scanf(%ld,&d_num);printf(n 輸入要取出的商品的數(shù)量:); scanf(%d,&s);j=0; while(ji) if(

23、scj.num=d_num) fp=fopen(入庫(kù)信息記錄.dat,wb+);fp1=fopen(入庫(kù)信息記錄.xls,w); fprintf(fp1,%st%st%st%st%st%sn,入庫(kù)編號(hào),商品編號(hào),入庫(kù)商品名,入庫(kù)數(shù)量,入庫(kù)價(jià)格,總 價(jià)); 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商品編號(hào):);scanf(%s,&p1-p_num);printf(n出庫(kù)商品名:)

24、;scanf(%s,&p1-name);printf(n出庫(kù)數(shù)量:);scanf(%d,&p1-amount);printf(n出庫(kù)價(jià)格:);scanf(%d,&p1-price);p1-t_price=p1-amount*p1-price;printf(n總價(jià):);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) pr

25、intf(退出輸入請(qǐng)按Y/y鍵,任意鍵繼續(xù):); scanf(%s,c); if(strcmp(c,y)=0|strcmp(c,Y)=0) fclose(pf); p2-next=NULL; return 0;else break; printf(n出庫(kù)編號(hào):);scanf(%ld,&p1-num);printf(n商品編號(hào):);scanf(%s,&p1-p_num);printf(n出庫(kù)商品名:);scanf(%s,&p1-name);printf(n出庫(kù)數(shù)量:);scanf(%d,&p1-amount);printf(n出庫(kù)價(jià)格:);scanf(%d,&p1-price);p1-t_pri

26、ce=p1-amount*p1-price;printf(n總價(jià):);printf(%dn,p1-t_price); fwrite(p1,OLEN,1,pf); fclose(pf); p2-next=NULL; return 0; int out_modify()/修改出庫(kù)數(shù)據(jù)/相當(dāng)于更新“出庫(kù)信息記錄”中的內(nèi)容 system(cls); long m_num; FILE *fp,*fp1; int i,j,n;int t=3; struct out_product xgN; fp=fopen(出庫(kù)信息記錄.dat,rb+); fp1=fopen(出庫(kù)信息記錄.xls,r+);printf(

27、出庫(kù)編號(hào) 商品編號(hào) 出庫(kù)商品名 出庫(kù)數(shù)量 出庫(kù)價(jià)格 總 價(jià)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(輸入要修改的商品的出庫(kù)編號(hào):);OXG: scanf(%ld,&m_num); j=0; while(ji) if(xgj.num=m_num) printf(nttt輸入新的出庫(kù)商品信息!

28、n);printf(n商品編號(hào):);scanf(%s,&xgj.p_num);printf(n出庫(kù)商品名:);scanf(%s,&);printf(n出庫(kù)數(shù)量:);scanf(%d,&xgj.amount);printf(n出庫(kù)價(jià)格:);scanf(%d,&xgj.price);xgj.t_price=xgj.price*xgj.amount;printf(n總價(jià):);printf(%dn,xgj.t_price);printf(ttt商品信息修改成功!n); printf(出庫(kù)編號(hào) 商品編號(hào) 出庫(kù)商品名 出庫(kù)數(shù)量 出庫(kù)價(jià)格 總 價(jià)n);printf( %-8ld %-8s %

29、-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(按回車(chē)鍵退回上一級(jí)菜單.);getchar();

30、getchar(); return 0; j+; t-; if(t=0) return 0; printf(n沒(méi)有找到該出庫(kù)編號(hào),還有%d次機(jī)會(huì),請(qǐng)重新輸入:,t); goto OXG; int out_select() /查詢出庫(kù)數(shù)據(jù) system(cls);FILE *fp; int i,j;int t=3; long s_num; struct out_product cxN; if(fp=fopen(出庫(kù)信息記錄.dat,rb)=NULL)printf(can not open filen); exit(0); printf(ttt-n);printf(ttt出庫(kù)貨物統(tǒng)計(jì)如下n);pr

31、intf(ttt-nn);printf(出庫(kù)編號(hào) 商品編號(hào) 出庫(kù)商品名 出庫(kù)數(shù)量 出庫(kù)價(jià)格 總 價(jià)n);printf(-n);for(i=0;fread(&cxi,OLEN,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(輸入要查詢的出庫(kù)編號(hào):); OCX:scanf(%ld,&s_num);j=0;while(ji) if(cxj.num=s_num

32、) printf(n查詢結(jié)果如下:nn); printf(出庫(kù)編號(hào) 商品編號(hào) 出庫(kù)商品名 出庫(kù)數(shù)量 出庫(kù)價(jià)格 總 價(jià)n);printf( %-8ld %-8s %-10s %-8d %-8d %-8dn, cxj.num,cxj.p_num,,cxj.amount,cxj.price,cxj.t_price);printf(按回車(chē)鍵退回上一級(jí)菜單.);getchar();getchar(); return 0;j+; t-; if(t=0) return 0;printf(n沒(méi)有找到該出庫(kù)編號(hào),還有%d次機(jī)會(huì),請(qǐng)重新輸入:,t); goto OCX; int out_delet

33、e() /刪除出庫(kù)數(shù)據(jù) system(cls);int i,n,j;int t=3; long d_num; struct out_product scN; FILE *fp,*fp1;fp=fopen(出庫(kù)信息記錄.dat,rb+); for(i=0;fread(&sci,OLEN,1,fp)!=NULL;i+); printf(輸入要?jiǎng)h除的商品的出庫(kù)編號(hào):);OSC:scanf(%ld,&d_num); j=0; while(ji) if(scj.num=d_num) for(n=j;ni-1;n+) scn=scn+1; fp=fopen(出庫(kù)信息記錄.dat,wb+); fp1=fop

34、en(出庫(kù)信息記錄.xls,w); fprintf(fp1,%st%st%st%st%st%sn,出庫(kù)編號(hào),商品編號(hào),出庫(kù)商品名,出庫(kù)數(shù)量,出庫(kù)價(jià)格,總 價(jià)); fseek(fp1,56L,0); for(n=0;nnum);printf(n商品編號(hào):);scanf(%s,&p1-p_num);printf(n退還貨物名:);scanf(%s,&p1-name);printf(n退貨數(shù)量:);scanf(%d,&p1-amount);printf(n退貨價(jià)格:);scanf(%d,&p1-price);p1-t_price=p1-price*p1-amount;printf(n總價(jià):);pri

35、ntf(%dn,p1-t_price); fwrite(p1,QLEN,1,pf); qhead=NULL; while(1) n=n+1; if(n=1) qhead=p1; else p2-next=p1; p2=p1; p1=(struct quit_product *)malloc(QLEN); while(1) printf(退出輸入請(qǐng)按Y/y鍵,任意鍵繼續(xù):); scanf(%s,c); if(strcmp(c,y)=0|strcmp(c,Y)=0) fclose(pf); p2-next=NULL; return 0;else break; printf(n退貨編號(hào):);scan

36、f(%ld,&p1-num);printf(n商品編號(hào):);scanf(%s,&p1-p_num);printf(n退還貨物名:);scanf(%s,&p1-name);printf(n退貨數(shù)量:);scanf(%d,&p1-amount);printf(n退貨價(jià)格:);scanf(%d,&p1-price);p1-t_price=p1-price*p1-amount;printf(n總價(jià):);printf(%dn,p1-t_price); fwrite(p1,QLEN,1,pf); fclose(pf); p2-next=NULL; return 0; int quit_modify() /

37、修改退貨數(shù)據(jù),相當(dāng)于更新數(shù)據(jù)庫(kù) system(cls);long m_num; FILE *fp,*fp1; int i,j,n;int t=3; struct quit_product xgN; fp=fopen(退貨信息記錄.dat,rb+); fp1=fopen(退貨信息記錄.xls,r+); printf(退貨編號(hào) 商品編號(hào) 退還貨物名 退貨數(shù)量 退貨價(jià)格 總 價(jià)n); printf(-n); for(i=0;fread(&xgi,QLEN,1,fp)!=NULL;i+)printf( %-8ld %-8s %-10s %-8d %-8d %-8dn, xgi.num,xgi.p_nu

38、m,,xgi.amount,xgi.price,xgi.t_price); printf(-n); printf(n輸入要修改的商品的退貨編號(hào):);QXG: scanf(%ld,&m_num); j=0; while(ji) if(xgj.num=m_num) printf(nttt輸入新的退還貨物信息!n);printf(n商品編號(hào):);scanf(%s,&xgj.p_num);printf(n退還貨物名:);scanf(%s,&);printf(n退貨數(shù)量:);scanf(%d,&xgj.amount);printf(n退貨價(jià)格:);scanf(%d,&xg

39、j.price);xgj.t_price=xgj.amount*xgj.price;printf(n總價(jià):);printf(%dn,xgj.t_price);printf(ttt商品信息修改成功!n); printf(退貨編號(hào) 商品編號(hào) 退還貨物名 退貨數(shù)量 退貨價(jià)格 總 價(jià)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,

40、QLEN,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(n按回車(chē)鍵退回上一級(jí)菜單.);getchar();getchar(); return 0; j+; t-; if(t=0) return 0; printf(n沒(méi)有找到該退貨編號(hào),還有%d次機(jī)會(huì),請(qǐng)重新輸入:,t); goto QXG; int quit_select() /查詢退貨數(shù)據(jù)system(cls);FILE *f

41、p;int i,j;int t=3;long s_num; struct quit_product cxN; if(fp=fopen(退貨信息記錄.dat,rb)=NULL)printf(找不到文件n); exit(0); printf(ttt-n);printf(ttt退還貨物統(tǒng)計(jì)如下n);printf(ttt-nn);printf(退貨編號(hào) 商品編號(hào) 退還貨物名 退貨數(shù)量 退貨價(jià)格 總 價(jià)n); printf(-n);for(i=0;fread(&cxi,QLEN,1,fp)!=NULL;i+)printf( %-8ld %-8s %-10s %-8d %-8d %-8dn, cxi.nu

42、m,cxi.p_num,,cxi.amount,cxi.price,cxi.t_price);printf(-n);fclose(fp);printf(n輸入要查詢的退貨編號(hào):); QCX:scanf(%ld,&s_num); j=0;while(ji) if(cxj.num=s_num) printf(n查詢結(jié)果如下:nn); printf(退貨編號(hào) 商品編號(hào) 退還貨物名 退貨數(shù)量 退貨價(jià)格 總 價(jià)n);printf( %-8ld %-8s %-10s %-8d %-8d %-8dn, cxj.num,cxj.p_num,,cxj.amount,cxj.pri

43、ce,cxj.t_price);printf(n按回車(chē)鍵退回上一級(jí)菜單.);getchar();getchar(); return 0; j+; t-; if(t=0) return 0; printf(n沒(méi)有找到該退貨編號(hào),還有%d次機(jī)會(huì),請(qǐng)重新輸入:,t); goto QCX; int quit_delete() /刪除不需要記錄了的退貨數(shù)據(jù) system(cls);int i,n,j;int t=3; long d_num; struct quit_product scN; FILE *fp,*fp1;fp=fopen(退貨信息記錄.dat,rb+); for(i=0;fread(&sc

44、i,QLEN,1,fp)!=NULL;i+); printf(nn輸入要?jiǎng)h除的商品的退貨編號(hào):);QSC:scanf(%ld,&d_num); j=0; while(ji) if(scj.num=d_num) for(n=j;ni-1;n+) scn=scn+1; fp=fopen(退貨信息記錄.dat,wb+); fp1=fopen(退貨信息記錄.xls,w); fprintf(fp1,%st%st%st%st%st%sn,退貨編號(hào),商品編號(hào),退還貨物名,退貨數(shù)量,退貨價(jià)格,總 價(jià)); fseek(fp1,56L,0); for(n=0;ni-1;n+) fwrite(&scn,QLEN,1

45、,fp); fprintf(fp1,%ldt%st%st%dt%dt%dn,scn.num,scn.p_num,,scn.amount,scn.price,scn.t_price); fclose(fp); fclose(fp1); printf(n 刪除成功!n); printf(n按回車(chē)鍵退回上一級(jí)菜單.);getchar();getchar(); return 0; j+; t-; if(t=0) return 0; printf(n沒(méi)有找到該退貨編號(hào),還有%d次機(jī)會(huì),請(qǐng)重新輸入:,t); goto QSC; int total() /商品總的記錄查詢,不刪除任何數(shù)據(jù) s

46、ystem(cls);printf(ttt*n); printf(ttt* *n); printf(ttt* 商品統(tǒng)計(jì)信息 *n); printf(ttt* *n); printf(ttt*nnn);struct product tj,s; int i=0;/char c;long s_sum=0,p_sum=0;FILE *fp;if(fp=fopen(商品信息記錄.xls,r)=NULL)printf(nnttt 還沒(méi)統(tǒng)計(jì)數(shù)據(jù)!n);/printf(nn按回車(chē)鍵退回上一級(jí)菜單.);/c=getchar();/c=getchar();system(pause);return 0; print

47、f(商品編號(hào) 商 品 名 型號(hào)/規(guī)格 商品數(shù)量 進(jìn) 貨 價(jià) 銷(xiāo) 售 價(jià)n); printf(-n); fseek(fp,56L,0); while(!feof(fp) fscanf(fp,%st%st%st%dt%dt%dn,&tj.p_num,&,&tj.spec,&tj.amount,&tj.price,&tj.s_price);p_sum+=tj.price*tj.amount;s_sum+=tj.amount;printf(%-8s %-8s %-10s %-8d %-8d %-8dn, tj.p_num,,tj.spec,tj.amount,tj.pric

48、e,tj.s_price); printf(-n);i+; printf(n商品種類(lèi)有:%d(種)n,i); printf(n商品總數(shù)為:%ld(件)n,s_sum); printf(n商品總進(jìn)貨價(jià)為:%ld(元)n,p_sum);/*while(1)printf(n按任意鍵退回上一級(jí)菜單.); scanf(%s,c);if(strcmp(c,Y)=0|strcmp(c,y)=0) return 0;*/printf(n按回車(chē)鍵退回上一級(jí)菜單.); / c=getchar();/ c=getchar();system(pause); return 0;int in_case() char ch

49、oice; choice=getchar();system(cls);printf(tttt*n); printf(tttt* *n); printf(tttt* 入庫(kù)信息管理 *n); printf(tttt* *n); printf(tttt*nnn); menu();while(1) printf(ntttt 輸入你的選擇:); scanf(%c,&choice); switch(choice) case 1: in_insert();Rkjl();getchar();break; case 2: in_delete();break; case 3: in_modify();break;

50、 case 4: in_select();break; default: return 0; /*switch(choice) case 1: in_insert();Rkjl();break; case 2: in_delete();break; case 3: in_modify();break; case 4: in_select();break; default: return 0; */ system(cls);printf(tttt*n); printf(tttt* *n); printf(tttt* 入庫(kù)信息管理 *n); printf(tttt* *n); printf(tttt*nnn);menu(); int out_case() char choice; getchar();system(cls);printf(tttt*n); printf(tttt* *n); printf(tttt* 出庫(kù)信息管理 *n); printf(tttt* *n); printf(tttt*nnn); menu();while(1) printf(ntttt輸入你的選擇:); scanf(%c,&choice); switch(choice) case 1: out_insert();Ckjl();getchar();break; case 2:

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論