仓库管理系统(c语言)

上传人:沈*** 文档编号:194677002 上传时间:2023-03-13 格式:PDF 页数:39 大小:715KB
收藏 版权申诉 举报 下载
仓库管理系统(c语言)_第1页
第1页 / 共39页
仓库管理系统(c语言)_第2页
第2页 / 共39页
仓库管理系统(c语言)_第3页
第3页 / 共39页
资源描述:

《仓库管理系统(c语言)》由会员分享,可在线阅读,更多相关《仓库管理系统(c语言)(39页珍藏版)》请在装配图网上搜索。

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

2、后台进行一系列的操作 新建数据并同时对其处理 修改数据 插入数据 删除数据 查找数据 查看数据 数据存档 修改密码 三、系统结构图#define LEN sizeof(struct shop)#include#include#include#include struct shop char name30;float price_in;float price_out;int num_in;int num_now;int num_sold;float win;float percent;struct shop*next;int n=0;void main(void)void auto1(struc

3、t shop*h_p);int menu1(struct shop*h_p);void print1(void);void assistant(struct shop*head);int password(void);int menu2(struct shop*h_p);void print2(void);void creat(struct shop*h_p);void rewrite(struct shop*h_p);void insert(struct shop*h_p);void deleat(struct shop*h_p);void search(struct shop*h_p);v

4、oid printall(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 shop*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

5、a30);void sort1(struct shop*h_p);void sort2(struct shop*h_p);void sort3(struct shop*h_p);void print3(void);void password_create(void);struct shop*addbuild(struct shop*h_p);int a;struct shop*head,*h_p;head=NULL;h_p=&head;auto1(h_p);do a=menu1(h_p);while(a!=3);system(cls);printf(谢谢使用_);getch();int men

6、u1(struct shop*h_p)int a,b;struct shop*head;head=*h_p;print1();scanf(%d,&a);putchar(n);getchar();do switch(a)case 1:assistant(head);break;case 2: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);int menu2(struct shop*h_p)int

7、b;char a;struct shop*head;head=*h_p;print2();scanf(%d,&b);putchar(n);getchar();do switch(b)case 1:creat(h_p);break;case 2:rewrite(h_p);break;case 3:insert(h_p);break;case 4:deleat(h_p);break;case 5:search(h_p);break;case 6:printall(h_p);break;case 7:head=*h_p;save(head);break;case 8:password_set();b

8、reak;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);void auto1(struct shop*h_p)if(password_exi(h_p)&data_exi(h_p)load(h_p);void print1(void)system(cls);printf(*n);printf(仓 库 管 理 系 统 n);pr

9、intf(*n);printf(n);printf(#*菜 单 *#n);printf(#|1.员工模式|#n);printf(#|2.店主模式|#n);printf(#|3.退出|#n);printf(#*#n);printf(n);printf(n 请选择(1-3):);void assistant(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);sca

10、nf(%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);else printf(n 此商品不存在或通知店主更新数据库n);printf(n 继续吗(y/n):);putchar(n);c=getchar();getchar();save(head);int password(void)FILE*fp;char a50,b50;int i;system(c

11、ls);fp=fopen(c:y_secrea,rb);fscanf(fp,%s,&a);fclose(fp);printf(请输入密码:n);putchar(n);i=0;do bi=getch();printf(*);i+;while(bi-1!=13&iname,0)=0)f=0;while(f)n+;if(n=1)head=j;f=1;printf(n 请输入下一种货物的数据.nn);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;void rewr

12、ite(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)goto end;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

13、/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 修改完成_nn);end:;void insert(struct shop*h_p)struct shop*i,*j,*x,*he

14、ad;head=*h_p;x=addbuild(h_p);i=j=head;while(strcmp(i-name,x-name)next!=NULL)j=i;i=i-next;if(strcmp(i-name,x-name)=0)if(i=head)head=x;else j-next=x;x-next=i;else i-next=x;x-next=NULL;printf(n 插入完成_nn.);*h_p=head;void deleat(struct shop*h_p)struct shop*i,*j,*head;char a30,b;head=*h_p;do system(cls);pr

15、intf(n 请输入你要删除的货物的名称:n);putchar(n);gets(a);if(n=1&!search1(h_p,a)printf(n 不存在的货物名称!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-next!=NULL)j=i;i=i-next;if(strcmp(i-name,a)=0)if(i=head)head=i-next;

16、free(i);else j-next=i-next;n-;printf(n 删除完成_.nn);*h_p=head;end:;void search(struct shop*h_p)int begin,end,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-next!=NULL)i=i-next;if(strcmp(i-name,a)=0)printf(n 名称t 进价t 售价t 进货数目 存货数

17、目 销量 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);else printf(n 此货物不存在!n);getch();void printall(struct shop*h_p)int a,c;char b=y;struct shop*i;while(b=y)do system(cls);print3();scanf(%d,&a);while(a!=1

18、&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-next!=NULL;i=i-next,c+)printf(n名称t进价t售价t进货数目 存货数目 销量 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-

19、num_sold,i-win,i-percent,c);if(c%8=0)getch();getchar();printf(按任意键继续。n);printf(n名称t进价t售价t进货数目 存货数目 销量 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

20、/n):);scanf(%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=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-

21、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(attrib c:y_data+h);printf(n_已保存n);void password_set()FILE*fp;int i,f=0,t=0;char a20,b20;do if(password()do system(cls);printf(请输入新密码(319 位):n);putchar(n)

22、;i=0;do ai=getch();printf(*);i+;while(ai-1!=13&i19);ai-1=0;printf(n 请确认新密码:n);putchar(n);i=0;do bi=getch();printf(*);i+;while(bi-1!=13&i2)t=1;system(attrib c:y_secrea-h);system(del c:y_secrea);fp=fopen(c:y_secrea,wb+);fprintf(fp,%s,a);fclose(fp);printf(n 密码修改完成_n);while(t=0);else f+;if(f=3)break;whi

23、le(t=0);int password_exi(struct shop*h_p)FILE*fp;if(fp=fopen(c:y_secrea,rb)!=NULL)fclose(fp);return 1;else password_create();creat(h_p);save(*h_p);return 0;int data_exi(struct shop*h_p)FILE*fp;if(fp=fopen(c:y_data,rb)!=NULL)fclose(fp);return 1;else creat(h_p);save(*h_p);return 0;void load(struct sho

24、p*h_p)FILE*fp;struct shop*head,*i,*j;head=NULL;j=i=(struct shop*)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=(struct shop*)malloc(LEN);j-n

25、ext=i;j=i;j-next=NULL;*h_p=head;fclose(fp);struct shop*addbuild(struct shop*h_p)struct shop*i;int b,f;float c;char a30;i=(struct shop*)malloc(LEN);do f=0;printf(n 请输入名称:nn);scanf(%s,a);if(n=1&search1(h_p,a)printf(n 名称重复!n);f=1;while(f);strcpy(i-name,a);if(strcmp(i-name,0)=0)return(i);printf(请输入进价:nn

26、);scanf(%f,&c);i-price_in=c;printf(请输入售价:nn);scanf(%f,&c);i-price_out=c;printf(请输入进货数目:nn);scanf(%d,&b);i-num_in=b;printf(请输入现存数目:nn);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);v

27、oid sort0(struct shop*h_p)struct shop*i,*j,*z,*sei,*jt,*seit;int ni,nj,np,t;char sm30;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

28、!=ni)for(t=1,j=*h_p;tnext,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;tnext,t+);seit=sei-next;z=sei-next;sei-next=j-next;j-next=z;z=jt-next;jt-next=seit-next;seit-next=z;int search1(struct shop*h_p,char a30)struct shop*i;int j;for(i=*h_p,j=1;jnext)if(strcmp

29、(a,i-name)=0)return 1;if(strcmp(a,i-name)=0)return 1;else return 0;void sort1(struct shop*h_p)struct shop*i,*j,*z,*sei,*jt,*seit;int ni,nj,np,t;int sm;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(smnum_sold)np=nj;sm=j-num_sold

30、;if(j-next=NULL)if(smnum_sold)np=nj;if(np!=ni)for(t=1,j=*h_p;tnext,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;tnext,t+);seit=sei-next;z=sei-next;sei-next=j-next;j-next=z;z=jt-next;jt-next=seit-next;seit-next=z;void sort2(struct shop*h_p)struct shop*i,*j,*z

31、,*sei,*jt,*seit;int ni,nj,np,t;float sm;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(smwin)np=nj;sm=j-win;if(j-next=NULL)if(smwin)np=nj;if(np!=ni)for(t=1,j=*h_p;tnext,t+);jt=j-next;i=jt;if(ni=1)seit=*h_p;z=*h_p;*h_p=j-next;j-next=z

32、;else for(t=1,sei=*h_p;tnext,t+);seit=sei-next;z=sei-next;sei-next=j-next;j-next=z;z=jt-next;jt-next=seit-next;seit-next=z;void sort3(struct shop*h_p)struct shop*i,*j,*z,*sei,*jt,*seit;int ni,nj,np,t;float sm;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-

33、next!=NULL;j=j-next,nj+)if(smpercent)np=nj;sm=j-percent;if(j-next=NULL)if(smpercent)np=nj;if(np!=ni)for(t=1,j=*h_p;tnext,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;tnext,t+);seit=sei-next;z=sei-next;sei-next=j-next;j-next=z;z=jt-next;jt-next=seit-next;seit

34、-next=z;void print3(void)system(cls);printf(*n);printf(仓 库 管 理 系 统 n);printf(*n);printf(n);printf(#*菜 单 *#n);printf(#|1.按销量|#n);printf(#|2.按赢利|#n);printf(#|3.按利率|#n);printf(#*#n);printf(n);printf(请选择(1-3):);void password_create(void)FILE*fp;int i,f=0;char a20,b20;do system(cls);printf(n 请输入密码(319 位):n);putchar(n);i=0;do ai=getch();printf(*);i+;while(ai-1!=13&i19);ai-1=0;printf(n 请确认密码(319 位):n);putchar(n);i=0;do bi=getch();printf(*);i+;while(bi-1!=13&i2)f=1;fp=fopen(c:y_secrea,wb+);fprintf(fp,%s,a);fclose(fp);system(attrib c:y_secrea+h);while(f=0);

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

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!