《c语言销售管理系统12006.pdf》由会员分享,可在线阅读,更多相关《c语言销售管理系统12006.pdf(23页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、 11.C2.3.4.C5.6.C7.;8.c21-4 1-5 123112(3123 4 34N-S:#inelude stdio.h,name4typedef struct int menu_select();/*/int enter(RECODE t);/*/void salor(RECODE 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(RECO
2、DE t,int n);/*/int load(RECODE t);/*/#in cludepro.h 2.RECODEec600for(;)switch(menu_select()case 1:len gth=e nter(rec);breakprintf 07do while(c7)07return 3.scanfforti.num 4saveif if(fp=fope n(record.txt,wb)=NULL)printf(n n)fprintf fprintf(fp,%d,n)fprintf fprin tf(fp,rn)forfprintf fprin tf(fp,%-10d%-7
3、d%-7d%-7d%-7d-7d,ti.name,ti.a1,ti.a2,ti.a3,ti.a4,ti.a5)7fcloseprintf5.record.txt FILE*fpifif(fp=fope n(record.txt,rb)=NULL)printf(n)exitfscan f(fp,%d,&n)forfprin tf(fp,%-10d%-7d%-7d%-7d%-7d-7d,ti.name,ti.a1,ti.a2,ti.a3,ti.a4,ti.a5)fscan f(fp,%d%d%d%d%d%d,&(ti.name),&(ti.a1),&(ti.a2),&(ti.a3),&(ti.a4
4、),&(ti.a5)fclose(fp)printf 6.31).inti,j,sum0=0,sum1=0,sum2=0,sum3=0,sum4=0,sum5=0;int c4,b14=0,b24=0,b34=0,b44=0,b54=0 for for(i=0;i4;i+)for for(i=0;in;i+)for(j=0;j4;j+)forfor(i=0;i4;i+)printf sumsystem(cls)printf for2).scanf(%d,&s)printf forfor(i=0;in;i+),if(strcmp(name,ti.name)=0)in t c4,m4 forfor
5、(i=0;i4;i+)for(j=i+1;j4;j+)if prin tf(%dn,mi)3).ci=sum(t,n,i+1),forsumO+=ciforforprintf 51.=:Vt c-01Debu g01.eweF I?X 2.1 3.28 4.2 press any key to continue.NHXiM ENU KN 3 K K K 3WX X W K N iM K K 5.33 4 5 6 7 0-7P:T1*C+-bGlDebug01.exeF t-F:VS;4-4-01Debu g01 Exh 1 2 3 4 0 press ani/key to continue.6
6、.4 name product!ppoduct2 ppoduct3 pruduct4 produ 1 2 2 3:t 4 4 4 4 4 4 6 6 7 7 4 8 8 8 8 J|g iw of Sd L 1(1 reCOdB w M Hw press any key to continue.7.5 -*F:VtnC+4-01Debu c01,exe 8.3-R4-4-01Debu g01.exeF 3 nane product!product2 produet3 product4 product5 3 10 10 pres&enter to Continue.10 10 10 5 6 7
7、0 w END*S8.6 -F:C 4-4-DlDebu g01.ewe products code nun sum 36 40 50 68 18Q 8 10 12 36 key 10 12 36 8 10 12 36 8 10 12 36 ps um pre&s XKacKgMnitJtJtJtnjKJicxKKacgHHEJfJtJitKKXiMKKNiKigHHENll 3t:Kaaaa anij ta continue 0-?:9.71 2 6 0 0-?:seduce of salor salihg nuRber fI*DII mbfiy to few F:nC 4-4-01DebL
8、i g01.exe ny to continue 10.0 11.TXT 6cCcc6 0 1 2 3 any key to continue M;JC X X FND*:K XJOCSI sequce of salor salihg nunber fI*DII to few put any to continue 3!HENll*c:#in elude stdio.h/*#i nclude stdlib.h/*#include string.h/*#in elude ctype.h/*/*/*/*/typedef struct/*/int n ame;/*int a1;/*int a2;/*
9、int a3;/*int a4;/*int a5;/*RECODE;*/*/*/*/*/*/int menu_select();/*/int enter(RECODE t);/*/void salor(RECODE 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);/*/*/int
10、ma in()/*/*/RECODE rec600;int len gth;system(cls);/*/for(;)/*/switch(me nu _select()/*/case 1:le ngth=e nter(rec);break;case 2:save(rec,le ngth);break;case 3:le ngth=load(rec);break;case 4:list1(rec,le ngth);break;case 5:salor(rec,le ngth);break;case 6:list2(rec,le ngth);break;case 7:list3(rec,le ng
11、th);break;case 0:exit(0);int menu_select()/*/int n;prin tf(*MENU*nn);printf(1 n);printf(2 n);printf(3 n);printf(4 n);printf(”5 n);printf(6 n);printf(7 n);printf(0 n);prin tf(*END*nn)printf(0-7):n);scan f(%d,&n);if(0n&*7)system(cls);/*/return n;/*/int enter(RECODE t)int i,num;system(cls);/*/prin tf(n
12、);scanf(%d,&num);/*/printf(n ame product1 product2 product3 product4 product5);for(i=0;i nu m;i+)/*/printf(nn-n);sca nf(%d%d%d%d%d%d,&ti.name,&ti.a1,&ti.a2,&ti.a3,&ti.a4,&ti a5);printf(n-nnn);return i;/*/void save(RECODE t,int n)int i;FILE*fp;/*fopen*/if(fp=fopen(record.txt,wb)=NULL)/*/printf(n);/*/
13、exit(1);fprin tf(fp,%d,n);fprin tf(fp,rn);for(i=0;i n;i+)fprin tf(fp,%-10d%-7d%-7d%-7d%-7d%-7d,ti.name,ti.a1,ti.a2,ti.a3,ti.a4,ti.a5);/*fp*/fprin tf(fp,rn);fclose(fp);/*/printf(*nn);/*/prin tf(press any key to continue.n);getchar();/*/int load(RECODE t)int i,n;FILE*fp;if(fp=fopen(record.txt,r)=NULL)
14、/*/printf(n);/*/exit(1);fscan f(fp,%d,&n);for(i=0;i n;i+)fscan f(fp,%d%d%d%d%d%d,&(ti.name),&(ti.a1),&(ti.a2),&(ti.a3),&(ti.a4),&(ti.a5);/*fp*/fclose(fp);printf(n n);/*/prin tf(press any key to continue.nn);getchar();return n;/*/void list1(RECODE t,int n)int i;FILE*fp;if(fp=fopen(record.txt,r)=NULL)
15、/*/printf(n);/*/exit(1);fscan f(fp,%d,&n);for(i=0;i n;i+)fscan f(fp,%d%d%d%d%d%d,&(ti.name),&(ti.a1),&(ti.a2),&(ti.a3),&(ti.a4),&(ti.a5);/*fp*/fclose(fp);recode*nnn);printf(n ame product1 product2 product3 product4 product5);for(i=0;i n;i+)/*/printf(nn-n);printf(%d%d%d%d%d,ti.a1,ti.a2,ti.a3,ti.a4,ti
16、.a5);printf(nn-n);printf(n press any key to continue.n);getchar();/*/void salor(RECODE t,i nt n)int i,s;int b 仁 0,b2=0,b3=0,b4=0,b5=0;printf(1-4):n);scanf(%d,&s);/*/for(i=0;in;i+)/*/if(ti.name=s)prin tf(*the lise of sali ng%d,ti.name b1+=ti.a1;b2+=ti.a2;b3+=ti.a3;b4+=ti.a4;b5+=ti.a5;printf(n ame pro
17、ductl product2 product3 product4 product5n);printf(-n);prin tf(%-15d%-10d%-10d%-7d%-7d%-7d,s,b1,b2,b3,b4,b5);prin tf(npress en ter to continue.n);getchar();/*/int sum(RECODE t,int n,int e)int i,sum=0;for(i=0;i=n;i+)/*/if(e=ti.name)sum+=ti.a1;sum+=ti.a2;sum+=ti.a3;sum+=ti.a4;sum+=ti.a5;return sum;/*/
18、void list2(RECODE t,int n)int i,j,sum0=0,sum1=0,sum2=0,sum3=0,sum4=0,sum5=0;in t C4,b14=0,b24=0,b34=0,b44=0,b54=0;system(cls);for(i=0;i4;i+)ci=sum(t,n,i+1);/*/for(i=0;i4;i+)sum0+=ci;/*/for(i=0;in;i+)/*/for(j=0;j4;j+)if(j+1=ti.name)b1j+=ti.a1;b2j+=ti.a2;b3j+=ti.a3;b4j+=ti.a4;b5j+=ti.a5;for(i=0;i4;i+)
19、/*/sum1+=b1i;sum2+=b2i;sum3+=b3i;sum4+=b4i;sum5+=b5i;prin tf(products numn);prin tf(code 1 2 3 4 5 sumnn);for(i=0;i4;i+)printf(%-10d%-7d%-7d%-7d%-7d%-7d%-7dn,i+1,b1i,b2i,b3i,b4i,b5i,ci);prin tf(psum%-7d%-7d%-7d%-7d%-7d%-7d,sum1,sum2,sum3,sum4,sum5,sum0);prin tf(n press any key to continue.n);getchar
20、();/*/void list3(RECODE t,int n)int i,j,s;int c4,m4;/*/system(cls);/*/for(i=0;i4;i+)mi=i+1;for(i=0;i4;i+)ci=sum(t,n,mi);for(i=0;i4;i+)/*for(j=i+1;j4;j+)if(cicj)s=mi;mi=mj;mj=s;s=ci;ci=cj;cj=s;prin tf(the sequce of salorsali ng nu mber from many to fewn);for(i=0;i4;i+)/*/prin tf(%dn,mi);printf(ninput any key to continue.n);getchar();*/