版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
年4月19日倉庫管理系統(tǒng)c語言文檔僅供參考,不當(dāng)之處,請聯(lián)系改正。作品名稱開發(fā)者:系統(tǒng)背景:本軟件能減輕對貨物數(shù)目管理及價格盈虧等信息處理的工作量以便能快捷及時準(zhǔn)確的調(diào)整貨物的倉儲量達(dá)到最合理化。能夠使店主不失效率的節(jié)省大量精力用于其它方面符合當(dāng)今社會的商業(yè)形式而且本軟件體積小操作簡單是管理倉庫的不二選擇系統(tǒng)簡介:設(shè)計亮點:◆三級菜單使操作更簡便明了◆密碼操作能有效保證客戶信息的安全性◆獨特的dos命令調(diào)用使信息存儲的實體屬性為隱藏且無擴展名大大增大了安全系數(shù)◆數(shù)據(jù)結(jié)構(gòu)為鏈表擺脫了數(shù)據(jù)數(shù)量的限制◆提供三種查看模式并會標(biāo)出排名◆退出店主模式時會提示是否保存若選擇yes著進(jìn)行保存操作基本功能:·在員工模式下可輸入賣出貨物的名稱和數(shù)目程序自動在后臺進(jìn)行一系列的操作·新建數(shù)據(jù)并同時對其處理·修改數(shù)據(jù)·插入數(shù)據(jù)·刪除數(shù)據(jù)·查找數(shù)據(jù)·查看數(shù)據(jù)·數(shù)據(jù)存檔·修改密碼系統(tǒng)結(jié)構(gòu)圖#defineLENsizeof(structshop)#include<stdio.h>#include<conio.h>#include<string.h>#include<stdlib.h>structshop{charname[30];floatprice_in;floatprice_out;intnum_in;intnum_now;intnum_sold;floatwin;floatpercent;structshop*next;};intn=0;voidmain(void){voidauto1(structshop**h_p);intmenu1(structshop**h_p);voidprint1(void);voidassistant(structshop*head);intpassword(void);intmenu2(structshop**h_p);voidprint2(void);voidcreat(structshop**h_p);voidrewrite(structshop**h_p);voidinsert(structshop**h_p);voiddeleat(structshop**h_p);voidsearch(structshop**h_p);voidprintall(structshop**h_p);voidsave(structshop*head);voidpassword_set(void);intpassword_exi(structshop**h_p);intdata_exi(structshop**h_p);voidload(structshop**h_p);voidsave(structshop*head);structshop*addbuild(structshop**h_p);voidsort0(structshop**h_p);intsearch1(structshop**h_p,chara[30]);voidsort1(structshop**h_p);voidsort2(structshop**h_p);voidsort3(structshop**h_p);voidprint3(void);voidpassword_create(void);structshop*addbuild(structshop**h_p);inta;structshop*head,**h_p;head=NULL;h_p=&head;auto1(h_p);do{a=menu1(h_p);}while(a!=3);system("cls");printf("謝謝使用^_^");getch();}intmenu1(structshop**h_p){inta,b;structshop*head;head=*h_p;print1();scanf("%d",&a);putchar('\n');getchar();do{switch(a){case1:assistant(head);break;case2:if(password())do{b=menu2(h_p);}while(b!=9);break;default:break;}if(a!=3){system("cls");print1();scanf("%d",&a);}}while(a!=3);return(a);}intmenu2(structshop**h_p){intb;chara;structshop*head;head=*h_p;print2();scanf("%d",&b);putchar('\n');getchar();do{switch(b){case1:creat(h_p);break;case2:rewrite(h_p);break;case3:insert(h_p);break;case4:deleat(h_p);break;case5:search(h_p);break;case6:printall(h_p);break;case7:head=*h_p;save(head);break;case8:password_set();break;default:break;}if(b!=9){system("cls");print2();scanf("%d",&b);getchar();}}while(b!=9);printf("\n保存嗎?(y/n):");putchar('\n');scanf("%c",&a);if(a=='y'){head=*h_p;save(head);}return(b);}voidauto1(structshop**h_p){if(password_exi(h_p)&&data_exi(h_p))load(h_p);}voidprint1(void){system("cls");printf("********************************************************************************\n");printf("倉庫管理系統(tǒng)\n");printf("********************************************************************************\n");printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");printf("#*******************菜單*****************#\n");printf("#|1.員工模式|#\n");printf("#|2.店主模式|#\n");printf("#|3.退出|#\n");printf("#*********************************************#\n");printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");printf("\n請選擇(1-3):");}voidassistant(structshop*head){chara[50],c='y';intb;structshop*i;i=head;while(c=='y'){system("cls");printf("\n請輸入賣出的商品名稱:\n");gets(a);putchar('\n');printf("\n請輸入賣出的商品數(shù)量:\n");scanf("%d",&b);putchar('\n');while(strcmp(i->name,a)!=0&&i->next!=NULL)i=i->next;if(i->next!=NULL){i->num_now-=b;i->win=(i->num_in-i->num_now)*(i->price_out-i->price_in);}elseprintf("\n此商品不存在或通知店主更新數(shù)據(jù)庫\n");printf("\n繼續(xù)嗎?(y/n):");putchar('\n');c=getchar();getchar();}save(head);}intpassword(void){FILE*fp;chara[50],b[50];inti;system("cls");fp=fopen("c:\\y_secrea","rb");fscanf(fp,"%s",&a);fclose(fp);printf("請輸入密碼:\n");putchar('\n');i=0;do{b[i]=getch();printf("*");i++;}while(b[i-1]!=13&&i<19);b[i-1]='\0';if(strcmp(a,b)==0)return(1);elsereturn(0);}voidprint2(void){system("cls");printf("********************************************************************************\n");printf("店主模式\n");printf("********************************************************************************\n");printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");printf("#*******************菜單*****************#\n");printf("#|1.新建2.修改|#\n");printf("#|3.插入4.刪除|#\n");printf("#|5.查找6.查看|#\n");printf("#|7.保存8.改密|#\n");printf("#|9.上一層|#\n");printf("#*********************************************#\n");printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");printf("請選擇(1-9):");}voidcreat(structshop**h_p){structshop*head,*i,*j;intf=1;head=NULL;n=0;printf("\n請輸入數(shù)據(jù)若完成請在名稱處輸“0”i=j=addbuild(&head);if(strcmp(i->name,"0")==0)f=0;while(f){n++;if(n==1)head=j;f=1;printf("\n請輸入下一種貨物的數(shù)據(jù).\n\n");i=addbuild(&head);if(strcmp(i->name,"0")==0){free(i);f=0;break;}j->next=i;j=i;}j->next=NULL;*h_p=head;}voidrewrite(structshop**h_p){chara[30];structshop*i,*j,*head;head=*h_p;i=head;do{printf("\n請輸入要修改貨物的名稱:");putchar('\n');gets(a);if(n>=1&&!search1(h_p,a)){printf("\n不存在的貨物名稱!\n");getch();if(head==NULL)gotoend;}}while(n>=1&&!search1(h_p,a));while(strcmp(a,i->name)!=0&&i->next!=NULL){i=i->next;}if(strcmp(a,i->name)==0){printf("\n真的要修改嗎??(y/n):");putchar('\n');if(getchar()=='y'){getchar();j=addbuild(h_p);strcpy(i->name,j->name);i->price_in=j->price_in;i->price_out=j->price_out;i->num_in=j->num_in;i->num_now=j->num_now;i->num_sold=j->num_sold;i->win=j->win;i->percent=j->percent;free(j);printf("\n修改完成^_^\n\n");}}end:;}voidinsert(structshop**h_p){structshop*i,*j,*x,*head;head=*h_p;x=addbuild(h_p);i=j=head;while(strcmp(i->name,x->name)<0&&i->next!=NULL){j=i;i=i->next;}if(strcmp(i->name,x->name)>=0){if(i==head)head=x;elsej->next=x;x->next=i;}else{i->next=x;x->next=NULL;}printf("\n插入完成^_^\n\n.");*h_p=head;}voiddeleat(structshop**h_p){structshop*i,*j,*head;chara[30],b;head=*h_p;do{system("cls");printf("\n請輸入你要刪除的貨物的名稱:\n");putchar('\n');gets(a);if(n>=1&&!search1(h_p,a)){printf("\n不存在的貨物名稱!\n");if(head==NULL)gotoend;}}while(n>=1&&!search1(h_p,a));printf("\n真的要刪除嗎?(y/n):");putchar('\n');b=getchar();getchar();if(b=='y'){i=head;while(strcmp(i->name,a)!=0&&i->next!=NULL){j=i;i=i->next;}if(strcmp(i->name,a)==0){if(i==head){head=i->next;free(i);}elsej->next=i->next;n--;printf("\n刪除完成^_^.\n\n");*h_p=head;}}end:;}voidsearch(structshop**h_p){intbegin,end,mid,t;chara[30];structshop*i,*head;head=*h_p;i=head;printf("\n請輸入要查詢貨物的名稱:");putchar('\n');gets(a);while((strcmp(i->name,a)!=0)&&i->next!=NULL){i=i->next;}if((strcmp(i->name,a)==0)){printf("\n名稱\t進(jìn)價\t售價\t進(jìn)貨數(shù)目存貨數(shù)目銷量\t贏利\t利率\n");printf("\n===============================================================================\n");printf("%s%10.2f%10.2f%10d%10d%10d%9.2f%10.2f",i->name,i->price_in,i->price_out,i->num_in,i->num_now,i->num_sold,i->win,i->percent);}elseprintf("\n此貨物不存在!\n");getch();}voidprintall(structshop**h_p){inta,c;charb='y';structshop*i;while(b=='y'){do{system("cls");print3();scanf("%d",&a);}while(a!=1&&a!=2&&a!=3);switch(a){case1:sort1(h_p);break;case2:sort2(h_p);break;case3:sort3(h_p);break;default:break;}for(c=1,i=*h_p;i->next!=NULL;i=i->next,c++){printf("\n名稱\t進(jìn)價\t售價\t進(jìn)貨數(shù)目存貨數(shù)目銷量\t贏利\t利率\t排名\n");printf("\n===============================================================================\n");printf("%s%10.2f%10.2f%10d%10d%10d%9.2f%10.2f%8d",i->name,i->price_in,i->price_out,i->num_in,i->num_now,i->num_sold,i->win,i->percent,c);if(c%8==0){getch();getchar();printf("按任意鍵繼續(xù)。。。\n");}}printf("\n名稱\t進(jìn)價\t售價\t進(jìn)貨數(shù)目存貨數(shù)目銷量\t贏利\t利率\t排名\n");printf("\n===============================================================================\n");printf("%s%10.2f%10.2f%10d%10d%10d%9.2f%10.2f%8d",i->name,i->price_in,i->price_out,i->num_in,i->num_now,i->num_sold,i->win,i->percent,c);getch();getchar();system("cls");printf("查看其它排列方式?(y/n):");scanf("%c",&b);putchar('\n');}}voidsave(structshop*head){FILE*fp;structshop*i;system("attribc:\\y_data-h");system("delc:\\y_data");fp=fopen("c:\\y_data","wb+");i=head;for(i=head;i->next!=NULL;i=i->next){fprintf(fp,"%s%7.2f,%.2f,%d,%d,%d,%.2f,%.2f,",i->name,i->price_in,i->price_out,i->num_in,i->num_now,i->num_sold,i->win,i->percent);}fprintf(fp,"%s%7.2f,%.2f,%d,%d,%d,%.2f,%.2f,",i->name,i->price_in,i->price_out,i->num_in,i->num_now,i->num_sold,i->win,i->percent);fclose(fp);system("attribc:\\y_data+h");printf("\n^_^已保存\n");}voidpassword_set(){FILE*fp;inti,f=0,t=0;chara[20],b[20];do{if(password()){do{system("cls");printf("請輸入新密碼(3~19位):\n");putchar('\n');i=0;do{a[i]=getch();printf("*");i++;}while(a[i-1]!=13&&i<19);a[i-1]='\0';printf("\n請確認(rèn)新密碼:\n");putchar('\n');i=0;do{b[i]=getch();printf("*");i++;}while(b[i-1]!=13&&i<19);b[i-1]='\0';if(strcmp(a,b)==0&&i>2){t=1;system("attribc:\\y_secrea-h");system("delc:\\y_secrea");fp=fopen("c:\\y_secrea","wb+");fprintf(fp,"%s",a);fclose(fp);printf("\n密碼修改完成^_^\n");};}while(t==0);}elsef++;if(f==3)break;}while(t==0);}intpassword_exi(structshop**h_p){FILE*fp;if((fp=fopen("c:\\y_secrea","rb"))!=NULL){fclose(fp);return1;}else{password_create();creat(h_p);save(*h_p);return0;}}intdata_exi(structshop**h_p){FILE*fp;if((fp=fopen("c:\\y_data","rb"))!=NULL){fclose(fp);return1;}else{creat(h_p);save(*h_p);return0;}}voidload(structshop**h_p){FILE*fp;structshop*head,*i,*j;head=NULL;j=i=(structshop*)malloc(LEN);if((fp=fopen("c:\\y_data","rb"))!=NULL){while(!feof(fp)){fscanf(fp,"%s%f,%f,%d,%d,%d,%f,%f",i->name,&i->price_in,&i->price_out,&i->num_in,&i->num_now,&i->num_sold,&i->win,&i->percent);n++;if(n==1)head=j;if(!feof(fp))i=(structshop*)malloc(LEN);j->next=i;j=i;}j->next=NULL;*h_p=head;fclose(fp);}}structshop*addbuild(structshop**h_p){structshop*i;intb,f;floatc;chara[30];i=(structshop*)malloc(LEN);do{f=0;printf("\n請輸入名稱:\n\n");scanf("%s",a);if(n>=1&&search1(h_p,a)){printf("\n名稱重復(fù)!\n");f=1;}}while(f);strcpy(i->name,a);if(strcmp(i->name,"0")==0)return(i);printf("請輸入進(jìn)價:\n\n");scanf("%f",&c);i->price_in=c;printf("請輸入售價:\n\n");scanf("%f",&c);i->price_out=c;printf("請輸入進(jìn)貨數(shù)目:\n\n");scanf("%d",&b);i->num_in=b;printf("請輸入現(xiàn)存數(shù)目:\n\n");scanf("%d",&b);i->num_now=b;i->num_sold=i->num_in-i->num_now;i->win=(i->num_in-i->num_now)*(i->price_out-i->price_in);i->percent=(i->price_out-i->price_in)/(i->price_in);return(i);}voidsort0(structshop**h_p){structshop*i,*j,*z,*sei,*jt,*seit;intni,nj,np,t;charsm[30];if(n>=2)for(i=*h_p,ni=1;i->next!=NULL;i=i->next,ni++){strcpy(sm,i->name);np=ni;for(j=i->next,nj=ni+1;j->next!=NULL;j=j->next,nj++)if(strcmp(sm,j->name)>0){np=nj;strcpy(sm,j->name);}if(j->next==NULL)if(strcmp(sm,j->name)>0)np=nj;if(np!=ni){for(t=1,j=*h_p;t<np-1;j=j->next,t++);jt=j->next;i=jt;if(ni==1){seit=*h_p;z=*h_p;*h_p=j->next;j->next=z;}else{for(t=1,sei=*h_p;t<ni-1;sei=sei->next,t++);seit=sei->next;z=sei->next;sei->next=j->next;j->next=z;}z=jt->next;jt->next=seit->next;seit->next=z;}}}intsearch1(structshop**h_p,chara[30]){structshop*i;intj;for(i=*h_p,j=1;j<n;j++,i=i->next){if(strcmp(a,i->name)==0)return1;};if(strcmp(a,i->name)==0)return1;elsereturn0;}voidsort1(structshop**h_p){structshop*i,*j,*z,*sei,*jt,*seit;intni,nj,np,t;intsm;if(n>=2)for(i=*h_p,ni=1;i->next!=NULL;i=i->next,ni++){sm=i->num_sold;np=ni;for(j=i->next,nj=ni+1;j->next!=NULL;j=j->next,nj++)if(sm<j->num_sold){np=nj;sm=j->num_sold;}if(j->next==NULL)if(sm<j->num_sold)np=nj;if(np!=ni){for(t=1,j=*h_p;t<np-1;j=j->next,t++);jt=j->next;i=jt;if(ni==1){seit=*h_p;z=*h_p;*h_p=j->next;j->next=z;}else{for(t=1,sei=*h_p;t<ni-1;sei=sei->next,t++);seit=sei->next;z=sei->next;sei->next=j->next;j->next=z;}z=jt->next;jt->next=seit->next;seit->next=z;}}}voidsort2(structshop**h_p){structshop*i,*j,*z,*sei,*jt,*seit;intni,nj,np,t;floatsm;if(n>=2)for(i=*h_p,ni=1;i->next!=NULL;i=i->next,ni++){sm=i->win;np=ni;for(j=i->next,nj=ni+1;j->next!=NULL;j=j->next,nj++)if(sm<j->win){np=nj;sm=j->win;}if(j->next==NULL)if(sm<j->win)np=nj;if(np!=ni){for(t=1,j=*h_p;t<np-1;j=j->next,t++);jt=j->next;i=jt;if(ni==1){seit=*h_p;z=*h_p;*h_p=j->next;j->next=z;}else{for(t=1,sei=*h_p;t<ni-1;sei=sei->next,t++);seit=sei->next;z=sei->next;sei->next=j->next;j->next=z;}z=jt->next;jt->next=seit->next;seit->next=z;}}}voidsort3(structshop**h_p){structshop*i,*j,*z,*sei,*jt,*seit;intni,nj,np,t;floatsm;if(n>=2)for(i=*h_p,ni=1;i->next!=NULL;i=i->next,ni++){sm=i->percent;np=ni;for(j=i->next,nj=ni+1;j->next!=NULL;j=j->next,nj++)if(sm<j->percent){np=nj;sm=j->percent;}if(j->next==NULL)if(sm<j->percent)np=nj;if(np!=ni){for(t=1,j=*h_p;t<np-1;j=j->next,t++);jt=j->next;i=jt;if(ni==1){seit=*h_p;z=*h_p;*h_p=j->next;j->next=z;}else{for(t=1,sei=*h_p;t<ni-1;sei=sei->next,t++);
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度二手房買賣合同租賃管理及轉(zhuǎn)租服務(wù)合同4篇
- 2025年度二手摩托車交易及售后服務(wù)保障協(xié)議書4篇
- 校園文化對學(xué)生創(chuàng)新能力的影響與實踐研究
- 科技引領(lǐng)下的農(nóng)村商業(yè)生態(tài)構(gòu)建與優(yōu)化
- 教育領(lǐng)域的student-centeredness與學(xué)生評教的關(guān)系研究
- 2025年時尚潮流商品陳列合作協(xié)議4篇
- 2025年度中央廚房食材供應(yīng)承包合同4篇
- 個人停車位買賣標(biāo)準(zhǔn)合同2024版B版
- 二零二五電影劇本保密合同范本2篇
- 2025年度物流行業(yè)承兌擔(dān)保協(xié)議4篇
- 2025貴州貴陽市屬事業(yè)單位招聘筆試和高頻重點提升(共500題)附帶答案詳解
- 2024年住院醫(yī)師規(guī)范化培訓(xùn)師資培訓(xùn)理論考試試題
- 期末綜合測試卷(試題)-2024-2025學(xué)年五年級上冊數(shù)學(xué)人教版
- 2024年廣東省公務(wù)員錄用考試《行測》試題及答案解析
- 結(jié)構(gòu)力學(xué)本構(gòu)模型:斷裂力學(xué)模型:斷裂力學(xué)實驗技術(shù)教程
- 黑色素的合成與美白產(chǎn)品的研究進(jìn)展
- 金蓉顆粒-臨床用藥解讀
- 法治副校長專題培訓(xùn)課件
- 《幼兒園健康》課件精1
- 汽車、電動車電池火災(zāi)應(yīng)對
- 中醫(yī)藥適宜培訓(xùn)-刮痧療法教學(xué)課件
評論
0/150
提交評論