




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1/25作品名稱本軟件能減輕對貨物數(shù)目管理及價(jià)格盈虧等信息處理的工作量以便能快捷及時(shí)準(zhǔn)于其他方面符合當(dāng)今社會(huì)的商業(yè)形式而且本軟件體積小操作簡單是管理倉庫的不二選擇◆三級菜單使操作更簡便明了◆密碼操作能有效保證客戶信息的安全性◆獨(dú)特的dos命令調(diào)用使信息存儲(chǔ)的實(shí)體屬性為隱藏且無擴(kuò)展名大大增大了安全系數(shù)◆數(shù)據(jù)結(jié)構(gòu)為鏈表擺脫了數(shù)據(jù)數(shù)量的限制◆提供三種查看模式并會(huì)標(biāo)出排名◆退出店主模式時(shí)會(huì)提示是否保存若選擇yes著進(jìn)行保存操作·在員工模式下可輸入賣出貨物的名稱和數(shù)目程序自動(dòng)在后臺進(jìn)行一系列的操作#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;ntnvoidmain(void){voidauto1(structshop**h_p);intmenu1(structshop**h_p);voidprint1(void);voidassistant(structshop*head);intpasswordvoid);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);2/25intsearch1(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);structshop*head,**h_p;dNULLhphead;auto1(h_p);{a=menu1(h_p);}while(a!=3);systemcls);printf("謝謝使用^_^");getch;}intmenu1(structshop**h_p){structshop*head;head=*h_p;scanf("%d",&a);putcharn');getchar();{switch(a){case1:assistant(head);break;case2:assword{b=menu2(h_p);}while(b!=9);3/25defaultbreak}fa{systemcls);scanf("%d",&a);}}while(a!=3);a}intmenu2(structshop**h_p){chara;structshop*head;head=*h_p;scanf("%d",&b);putcharn');getchar();{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;defaultbreak}fb{systemcls);scanf("%d",&b);getchar();4/255/25}}while(b!=9);printf("\n保存嗎?(y/n):");putcharn');scanf("%c",&a);ifay'){head=*h_p;savehead}b}voidauto1(structshop**h_p){if(password_exi(h_p)&&data_exi(h_p))loadhp);}voidprint1(void){systemcls);printf("********************************************************************************\n");\n");printf("********************************************************************************\n");\n");\n");\n");\n");\n");\n");\n");~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#*******************#|1.員工模式#|2.店主模式#|3.退出菜單*****************##*********************************************#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~printf("\n請選擇(1-3):");}voidassistant(structshop*head){chara[50],c='y';structshop*i;while(c=='y'){systemcls);printf("\n請輸入賣出的商品名稱:\n");gets(a);putcharn');printf("\n請輸入賣出的商品數(shù)量:\n");scanf("%d",&b);putcharn');while(strcmp(i->name,a)!=0&&i->next!=NULL)nextif(i->next!=NULL){i->num_now-=b;i->win=(i->num_in-i->num_now)*(i->price_out-i->price_in);}printf("\n此商品不存在或通知店主更新數(shù)據(jù)庫\n");putcharn');c=getchar();getchar();}savehead}intpasswordvoid){;chara[50],b[50];isystemcls);fp=fopen("c:\\y_secrea","rb");6/257/25fscanf(fp,"%s",&a);fclose(fp);printf("請輸入密碼:\n");putcharn');{bigetchprintf;}while(b[i-1]!=13&&i<19);bi1]='\0';if(strcmp(a,b)==0)}voidprint2(void){systemcls);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");\n");~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~printf("請選擇(1-9):");}voidcreat(structshop**h_p){structshop*head,*i,*j;dNULLprintf("\n請輸入數(shù)據(jù)若完成請?jiān)诿Q處輸“0”.\n\n");i=j=addbuild(&head);if(strcmp(i->name,"0")==0)f=0;while(f){fnf=1;printf("\n請輸入下一種貨物的數(shù)據(jù).\n\n");i=addbuild(&head);if(strcmp(i->name,"0")==0){free(i);f=0;}j->next=i;j=i;}j->next=NULL;hphead}voidrewrite(structshop**h_p)8/25{chara[30];structshop*i,*j,*head;head=*h_p;{printf("\n請輸入要修改貨物的名稱:");putcharn');gets(a);if(n>=1&&!search1(h_p,a)){getch;if(head==NULL)gotoend;}}while(n>=1&&!search1(h_p,a));while(strcmp(a,i->name)!=0&&i->next!=NULL){next}if(strcmp(a,i->name)==0){putcharn');if(getchar()=='y'){getcharj=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");}9/25}voidinsert(structshop**h_p){structshop*i,*j,*x,*head;head=*h_p;x=addbuild(h_p);dwhile(strcmp(i->name,x->name)<0&&i->next!=NULL){j=i;t}if(strcmp(i->name,x->name)>=0){dj->next=x;xnexti;}{txx->next=NULL;}printf("\n插入完成^_^\n\n.");hphead}voiddeleat(structshop**h_p){structshop*i,*j,*head;chara[30],b;head=*h_p;{systemcls);printf("\n請輸入你要?jiǎng)h除的貨物的名稱:\n");putcharn');gets(a);if(n>=1&&!search1(h_p,a))10/25{if(head==NULL)gotoend;}}while(n>=1&&!search1(h_p,a));printf("\n真的要?jiǎng)h除嗎?(y/n):");putcharn');chargetchar();ifby'){while(strcmp(i->name,a)!=0&&i->next!=NULL){j=i;next}if(strcmp(i->name,a)==0){head{extfree(i);}j->next=i->next;printf("\n刪除完成^_^.\n\n");ead}}11/2512/25}voidsearch(structshop**h_p){intbegin,end,mid,t;chara[30];structshop*i,*head;head=*h_p;printf("\n請輸入要查詢貨物的名稱:");putcharn');gets(a);while((strcmp(i->name,a)!=0)&&i->next!=NULL){next}if((strcmp(i->name,a)==0)){printf("\n名稱\t進(jìn)價(jià)\t售價(jià)\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);}printf("\n此貨物不存在!\n");getch;}voidprintall(structshop**h_p){charb='y';structshop*i;while(b=='y'){{systemcls);13/25scanf("%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;defaultbreak}for(c=1,i=*h_p;i->next!=NULL;i=i->next,c++){printf("\n名稱\t進(jìn)價(jià)\t售價(jià)\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);ifc%8==0){getch;getchar();}}printf("\n名稱\t進(jìn)價(jià)\t售價(jià)\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();systemcls);scanf("%c",&b);putcharn');14/25}}voidsave(structshop*head){pstructshop*i;system("attribc:\\y_data-h");system("delc:\\y_data");fp=fopen("c:\\y_data","wb+");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(){pintift=0;chara[20],b[20];{assword{{systemcls);printf("請輸入新密碼(3~19位):\n");putcharn');{ai]=getch();printf;}while(a[i-1]!=13&&i<19);a[i-1]='\0';printf("\n請確認(rèn)新密碼:\n");putcharn');{bigetchprintf;}while(b[i-1]!=13&&i<19);bi1]='\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);}f++;ff}while(t==0);}15/25intpassword_exi(structshop**h_p){pif((fp=fopen("c:\\y_secrea","rb"))!=NULL){fclose(fp);eturn}{rdcreatecreat(h_p);save(*h_p);}}intdata_exi(structshop**h_p){pif((fp=fopen("c:\\y_data","rb"))!=NULL){fclose(fp);eturn}{creat(h_p);save(*h_p);}}voidload(structshop**h_p){pstructshop*head,*i,*j;dNULLj=i=(structshop*)malloc(LEN);16/2517/25if((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);fneoffpi=(structshop*)malloc(LEN);j->next=i;j=i;}j->next=NULL;hpheadfclose(fp);}}structshop*addbuild(structshop**h_p){structshop*i;floatc;chara[30];i=(structshop*)malloc(LEN);{f=0;printf("\n請輸入名稱:\n\n");scanf("%s",a);if(n>=1&&search1(h_p,a)){f=1;}}while(f);strcpy(i->name,a);if(strcmp(i->name,"0")==0)printf("請輸入進(jìn)價(jià):\n\n");scanf("%f",&c);i->price_in=c;printf("請輸入售價(jià):\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);}voidsort0(structshop**h_p){structshop*i,*j,*z,*sei,*jt,*seit;intninjnpt;charsm[30];fnfor(i=*h_p,ni=1;i->next!=NULL;i=i->next,ni++){strcpy(sm,i->name);for(j=i->next,nj=ni+1;j->next!=NULL;j=j->next,nj++)if(strcmp(sm,j->name)>0){strcpy(sm,j->name);}if(j->next==NULL)if(strcmp(sm,j->name)>0)ifnp=ni){for(t=1,j=*h_p;t<np-1;j=j->next,t++);jt=j->next;18/25ifni{seit=*h_p;z=*h_p;hp=j->next;j->next=z;}{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;}jtnextjt->next=seit->next;seit->next=z;}}}intsearch1(structshop**h_p,chara[30]){structshop*i;for(i=*h_p,j=1;j<n;j++,i=i->next){if(strcmp(a,i->name)==0)eturnif(strcmp(a,i->name)==0)eturn}voidsort1(structshop**h_p){structshop*i,*j,*z,*sei,*jt,*seit;intninjnpt;19/25fnfor(i=*h_p,ni=1;i->next!=NULL;i=i->next,ni++){sm=i->num_sold;for(j=i->next,nj=ni+1;j->next!=NULL;j=j->next,nj++)if(sm<j->num_sold){sm=j->num_sold;}if(j->next==NULL)if(sm<j->num_sold)ifnp=ni){for(t=1,j=*h_p;t<np-1;j=j->next,t++);jt=j->next;ifni{seit=*h_p;z=*h_p;hp=j->next;j->next=z;}{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;}jtnextjt->next=seit->next;seit->next=z;}}}20/25voidsort2(structshop**h_p){structshop*i,*j,*z,*sei,*jt,*seit;intninjnpt;floatsm;fnfor(i=*h_p,ni=1;i->next!=NULL;i=i->next,ni++){sm=i->win;for(j=i->next,nj=ni+1;j->next!=NULL;j=j->next,nj++)if(sm<j->win){sm=j->win;}if(j->next==NULL)if(sm<j->win)ifnp=ni){for(t=1,j=*h_p;t<np-1;j=j->next,t++);jt=j->next;ifni{seit=*h_p;z=*h_p;hp=j->next;j->next=z;}{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;}jtnextjt->next=seit->next;seit->next=z;21/25}}}voidsort3(structshop**h_p){structshop*i,*j,*z,*sei,*jt,*seit;intninjnpt;floatsm;fnfor(i=*h_p,ni=1;i->next!=NULL;i=i->next,ni++){sm=i->percent;for(j=i->next,nj=ni+1;j->next!=NULL;j=j->next,nj++)if(sm<j->percent){sm=j->percent;}if(j->next==NULL)if(sm<j->percent)ifnp=ni){for(t=1,j=*h_p;t<np-1;j=j->next,t++);jt=j->next;ifni{seit=*h_p;z=*h_p;hp=j->next;j->next=z;}{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;22/2523/25}jtnextjt->next=seit->next;seit->next=z;}}}voidprint3(void){systemcls);printf("*********************
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025倉庫租賃合同范本版本
- 2025企業(yè)信貸合同范本
- 2025年小學(xué)語文畢業(yè)升學(xué)考試句式變換與修辭閱讀訓(xùn)練試卷
- 2025年足部按摩師(高級)考試試卷:足部按摩行業(yè)政策影響分析
- 2025年專升本藝術(shù)概論考試模擬試卷-藝術(shù)作品賞析技巧要點(diǎn)與藝術(shù)史
- 2025特種設(shè)備安全管理人員考試試卷:特種設(shè)備安全教育與培訓(xùn)案例分析
- 2025年高爾夫球教練職業(yè)能力測試卷-高爾夫球運(yùn)動(dòng)賽事組織與運(yùn)營管理
- 2025年專升本藝術(shù)概論模擬試卷-藝術(shù)批評理論在音樂作品鑒賞中的應(yīng)用試題
- 2025年食品檢驗(yàn)工(初級)食品檢驗(yàn)實(shí)驗(yàn)室安全管理規(guī)范考試試卷
- 2025年醫(yī)保政策改革核心考點(diǎn)考試題庫解析試卷
- GB/T 26646-2011無損檢測小型部件聲發(fā)射檢測方法
- GB/T 17689-2008土工合成材料塑料土工格柵
- 歐姆龍-單元cj1m-匚cpu22cpu23操作手冊
- 腎 部 保 養(yǎng)課件
- 中暑的預(yù)防與急救及夏季中醫(yī)養(yǎng)生課件
- 青少年犯罪課件
- 初中美術(shù)教學(xué)案例分析公開課一等獎(jiǎng)省優(yōu)質(zhì)課大賽獲獎(jiǎng)?wù)n件
- 污水處理操作工培訓(xùn)
- 臨時(shí)起搏器T10 T20課件
- 丹參保心茶市場操作手冊
- 爆破設(shè)計(jì)與施工試題庫(2022年修訂版)
評論
0/150
提交評論