仓库管理系统(c语言)_第1页
仓库管理系统(c语言)_第2页
已阅读5页,还剩20页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、仓库管理系统(c 语言)2 作者: 日期:3 作品名称 开发者: 一、 系统背景: 本软件能减轻对货物数目管理及价格盈亏等信息处理的工作量以便能快捷及 时准确的调整货物的仓储量达到最合理化。可以使店主不失效率的节省大量精 力用于其他方面符合当今社会的商业形式而且本软件体积小操作简单是管理 仓库的不二选择 二、 系统简介: 设计亮点: 三级菜单使操作更简便明了 密码操作能有效保证客户信息的安全性 独特的 dos 命令调用使信息存储的实体属性为隐藏且无扩展名大大增大了安全系数 数据结构为链表摆脱了数据数量的限制 提供三种查看模式并会标出排名 退出店主模式时会提示是否保存若选择 yes 着进行保存操

2、作 基本功能: 在员工模式下可输入卖出货物的名称和数目程序自动在后台进行一系列的操作 新建数据并同时对其处理 修改数据 插入数据 删除数据 查找数据 查看数据 数据存档 修改密码 4 三、 系统结构图5 #defi ne LEN sizeof(struct shop) #in clude #in clude #in clude #in clude struct shop char n ame30; float price_i n; float price_out; int num_in; int num_now; int nu m_sold; float win; float perce nt

3、; struct shop *n ext; ; int n=0; void mai n(void) void auto1(struct shop *h_p); int men u1(struct shop *h_p); void prin t1(void); void assista nt(struct shop *head); int password(void); int menu 2(struct shop *h_p); void prin t2(void); void creat(struct shop *h_p);齧令金亭采单三 I毎也:&互吞I 掠刼利査档 橄利迦:a:. 6 vo

4、id rewrite(struct shop *h_p); void in sert(struct shop *h_p); void deleat(struct shop *h_p); void search(struct shop *h_p); void prin tall(struct shop *h_p); void save(struct shop *head); void password_set(void); int password_exi(struct shop *h_p); int data_exi(struct shop *h_p); void load(struct sh

5、op *h_p); void save(struct shop *head); struct shop *addbuild(struct shop *h_p); void sort0(struct shop *h_p); int search1(struct shop *h_p,char a30); void sort1(struct shop *h_p); void sort2(struct shop *h_p); void sort3(struct shop *h_p); void prin t3(void); void password_create(void); struct shop

6、 *addbuild(struct shop *h_p); int a; struct shop *head,*h_p; head=NULL; h_p=&head; auto1(h_p); do a=me nu1(h_p); while(a!=3); system(cls); printf(谢谢使用 A_A); getch(); int men u1(struct shop *h_p) int a,b; struct shop *head; head=*h_p; prin t1(); scan f(%d,&a); putchar(n); getchar();7 do switch(a) cas

7、e 1:assista nt(head);break; case 2: if(password() do b=me nu 2(h_p); while(b!=9); break; default:break; if(a!=3) system(cls); prin t1(); scan f(%d,&a); while(a!=3); return(a); int menu 2(struct shop *h_p) int b; char a; struct shop *head; head=*h_p; prin t2(); scan f(%d,&b); putchar(n); getchar(); d

8、o switch(b) case 1:creat(h_p);break; case 2:rewrite(h_p);break; case 3:i nsert(h_p);break;8 case 4:deleat(h_p);break; case 5:search(h_p);break; case 6:pri ntall(h_p);break; case 7:head=*h_p;save(head);break; case 8:password_set();break; default:break; if(b!=9) system(cls); prin t2(); scan f(%d,&b);

9、getchar(); while(b!=9); printf(n 保存吗?(y/n):); putchar(n); scan f(%c,&a); if(a=y) head=*h_p; save(head); return(b); void auto1(struct shop *h_p) if(password_exi(h_p) & data_exi(h_p) load(h_p); void prin t1(void) system(cls); * *printf( ); printf(” 仓库管理系统 n); printf( *n printf(” 9 n); printf(n 请选择(1-3

10、):); void assista nt(struct shop *head) char a50,c=y: int b; struct shop *i; i=head; while(c=y) system(cls); printf(n请输入卖出的商品名称 :n); gets(a); putchar(n); printf(n请输入卖出的商品数量:n); scan f(%d,&b); putchar(n); while(strcmp(i- name,a)!=0&i-n ext!=NULL) i=i-n ext; if(i- next!=NULL) i-num_no w-=b; i-w in=(i-

11、num_in-i-num_no w)*(i-price_out-i-price_i n); else printf(n此商品不存在或通知店主更新数据库 n”); printf(n 继续吗? (y/n):); putchar(n);n); printf(” n); printf(” n); printf(” n); printf(” n); #* * 菜单 * *# #| 1.员工模式 1# #| 2.店主模式 1# #| 3.退出 |# printf(” n); printf(” * 10 printf(” n);c=getchar(); getchar(); save(head); int

12、password(void) FILE*fp; char a50,b50; int i; system(cls); fp=fope n(c:y_secrea,rb); fsca nf(fp,%s,&a); fclose(fp); printf(”请输入密码:n); putchar(n); i=0; do bi=getch(); prin tf(*); i+; while(bi-1!=13&in ame,0)=0) f=0; while(f) 请在名称处输“ 0” .nn); n+; if(n=1) head=j; f=1; printf(n请输入下一种货物的数据 i=addbuild(&hea

13、d); if(strcmp(i-n ame,0)=0) free(i); f=0; break; nn); 12 j-n ext=i; j=i; j-n ext=NULL; *h_P=head; void rewrite(struct shop *h_p) char a30; struct shop *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)

14、 goto end; while( n=1&!search1(h_p,a); while(strcmp(a,i- name)!=0&i-n ext!=NULL) i=i-n ext; if(strcmp(a,i-n ame)=0) printf(n 真的要修改吗? ?(y/n):); putchar(n); if(getchar()=y) getchar(); j=addbuild(h_p);13 strcpy(i-n ame,j-n ame); i-price_i n=j-price_i n; i-price_out=j-price_out; i-numn =j- num _i n; i-n

15、um_no w=j- num_now; i-nu m_sold=j-nu m_sold; i-wi n=j-wi n; i-perce nt=j-perce nt; free(j); printf(n 修改完成 A_Ann); en d:; void in sert(struct shop *h_p) struct shop *i,*j,*x,*head; head=*h_p; x=addbuild(h_p); i=j=head; while(strcmp(i-n ame,x- n ame)n ext!=NULL) j=i; i=i-n ext; if(strcmp(i-n ame,x- n

16、ame)=0) if(i=head) head=x; else j_n ext=x; x-n ext=i; else i-n ext=x; x-n ext=NULL; printf(n 插入完成 A_Ann.); *h_p=head; 14 void deleat(struct shop *h_p) struct shop*i,*j,*head; char a30,b; head=*h_p; do system(cls); printf(n请输入你要删除的货物的名称 :n); putchar(n); gets(a); if(n =1 &!search1(h_p,a) printf(n不存在的货

17、物名称! n); if(head=NULL) goto end; 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-n ext!=NULL) j=i; i=i-n ext; if(strcmp(i-n ame,a)=0) if(i=head) 15 head=i-n ext; free(i); else j-n ext=i-n ext; n-; printf(n 删除完成 A_A

18、.nn); *h_P=head; end:; void search(struct shop *h_p) int beg in,en d,mid,t; char a30; struct shop *i,*head; head=*h_p; i=head; printf(n请输入要查询货物的名称:”); putchar(n); gets(a); while(strcmp(i- name,a)!=0)&i-n ext!=NULL) i=i-n ext; if(strcmp(i-n ame,a)=0) printf(n名称t 进价t 售价t 进货数目 存货数目 销量t 赢利t 利率n); prin t

19、f(n= =n); prin tf(%s%10.2f%10.2f%10d%10d%10d%9.2f%10.2f,i- name,i-price_i n, i-price_out,i- n umn ,i-num_no w,i-nu m_sold,i-w in, i-perce nt); else printf(n 此货物不存在!n); getch(); 16 void prin tall(struct shop *h_p) int a,c; char b=y: struct shop *i; while(b=y) do system(cls); prin t3(); scan f(%d,&a);

20、 while(a!=1 &a!=2&a!=3); switch(a) case 1:sort1(h_p);break; case 2:sort2(h_p);break; case 3:sort3(h_p);break; default:break; for(c=1,i=*h_p;i-n ext!=NULL;i=i-n ext,c+) printf(n名称t 进价t 售价t 进货数目 存货数目 销量t 赢利t 利率t 排名 n); prin tf(n= =n); prin tf(%s%10.2f%10.2f%10d%10d%10d%9.2f%10.2f%8d,i- name,i-price_i

21、n, i-price_out,i -numn ,i-num_no w,i-nu m_sold,i-w in, i-perce nt,c); if(c%8=0) getch(); getchar(); printf(按任意键继续。n); 17 printf(n名称t 进价t 售价t 进货数目 存货数目 销量t 赢利t 利率t 排名 n); prin tf(n= =n); prin tf(%s%10.2f%10.2f%10d%10d%10d%9.2f%10.2f%8d,i- name,i-price_i n, i-price_out,i -numn ,i-num_no w,i-nu m_sold,

22、i-w in, i-perce nt,c); getch(); getchar(); system(cls); printf(查看其他排列方式? (y/n):); scan f(%c,&b); putchar(n); void save(struct shop *head) FILE *fp; struct shop *i; system(attrib c:y_data -h); system(del c:y_data); fp=fope n(c:y_data,wb+); i=head; for(i=head;i-n ext!=NULL;i=i-n ext) fprin tf(fp,%s%7.

23、2f,%.2f,%d,%d,%d,%.2f,%.2f,i- name,i-price_i n,i-price_out,i- numn ,i-num_no w,i-nu m_sold,i-w in, i-perce nt); fprin tf(fp,%s%7.2f,%.2f,%d,%d,%d,%.2f,%.2f,i- name,i-price_i n,i-price_out,i- numn ,i-num_no w,i-nu m_sold,i-w in, i-perce nt); fclose(fp); system(attrib c:y_data +h); printf(nA_A 已保存 n);

24、 void password_set() FILE *fp; int i,f=0,t=0; char a20,b20; do 18 if(password() do system(cls); printf(请输入新密码(319 位):n”); putchar(n); i=0; do ai=getch(); prin tf(*); i+; while(ai-1!=13&i19); ai-1=0; printf(n 请确认新密码:n); putchar(n); i=0; do bi=getch(); prin tf(*); i+; while(bi-1!=13&i2) t=1; system(at

25、trib c:y_secrea -h); system(del c:y_secrea); fp=fope n(c:y_secrea,wb+); fprin tf(fp,%s,a); fclose(fp); printf(n密码修改完成A_An); ; while(t=0);19 else f+; if(f=3) break; while(t=O); int password_exi(struct shop *h_p) FILE *fp; if(fp=fope n(c:y_secrea,rb)!=NULL) fclose(fp); return 1; else password_create()

26、; creat(h_p); save(*h_p); return 0; int data_exi(struct shop *h_p) FILE *fp; if(fp=fope n(c:y_data,rb)!=NULL) fclose(fp); return 1; else creat(h_p);20 save(*h_p); return 0; void load(struct shop *h_p) FILE *fp; struct shop *head,*i,*j; head=NULL; j=i=(struct shop *)malloc(LEN); if(fp=fope n(c:y_data

27、,rb)!=NULL) while(!feof(fp) fsca nf(fp,%s%f,%f,%d,%d,%d,%f,%f,i- name,&i-price_i n,&i-price_out,&i- numn,&i- n um_now,&i-nu m_sold,&i-w in,&i-perce nt); n+; if(n=1) head=j; if(!feof(fp) i=(struct shop*)malloc(LEN); j-n ext=i; j=i; j-n ext=NULL; *h_p=head; fclose(fp); struct shop *addbuild(struct sho

28、p *h_p) struct shop *i; int b,f; float c; char a30; i=(struct shop *)malloc(LEN); do 21 f=0; printf(n 请输入名称:nn); scan f(%s,a); if(n =1 &search1(h_p,a) printf(n 名称重复! n); f=1; while(f); strcpy(i-n ame,a); if(strcmp(i-n ame,0)=0) return(i); printf(” 请输入进价:nn); scan f(%f, &c); i-price_ in=c; printf(请输入

29、售价:nn); scan f(%f, &c); i-price_out=c; printf(请输入进货数目:nn); scan f(%d,&b); i-num_in=b; printf(请输入现存数目:nn); scan f(%d,&b); i-num_no w=b; i-num _sold=i-numn-i-num_now; i-w in=(i-num_in-i-num_no w)*(i-price_out-i-price_i n); i-perce nt=(i-price_out-i-price_ in)/(i-price_ in); return(i); void sort0(struc

30、t shop *h_p) struct shop *i,*j,*z,*sei,*jt,*seit; int n i,nj ,n p,t; char sm30; if(n =2) for(i=*h_p ,ni=1;i-n ext!=NULL;i=i-n ext ,ni+) strcpy(sm,i-n ame); np=ni; for(j=i-n ext,nj=ni+1;j-n ext!=NULL;j=j-n ext,nj+)22 if(strcmp(sm,j-n ame)0) n p=nj; strcpy(sm,j-n ame); if(j- next=NULL) if(strcmp(sm,j-

31、n ame)0) n p=nj; if(n p!=ni) for(t=1,j=*h_p;t n ext,t+); jt=j-n ext; i=jt; if(n i=1) seit=*h_p; z=*h_p; *h_p=j _n ext; j_n ext=z; else for(t=1,sei=*h_p;t n ext,t+); seit=sei-n ext; z=sei-n ext; sei-n ext=j-n ext; j_n ext=z; z=jt-n ext; jt- n ext=seit- n ext; seit- n ext=z; int search1(struct shop *h

32、_p,char a30) struct shop *i; int j; for(i=*h_p,j=1;j n ext) if(strcmp(a,i-n ame)=0) return 1;23 ; if(strcmp(a,i-n ame)=O) return 1; else return 0; void sort1(struct shop *h_p) struct shop *i,*j,*z,*sei,*jt,*seit; int n i,nj ,n p,t; int sm; if(n =2) for(i=*h_p ,ni=1;i-n ext!=NULL;i=i-n ext ,ni+) sm=i-nu m_sold; np=ni; for(j=i-n ext,nj=n i+1;j- next!=NULL;j=j- next,nj+) if(sm num _sold) n p=nj; sm=j-nu m_sold; if(j- next=NULL) if(sm num _

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论