仓库管理系统c语言文档格式.docx
《仓库管理系统c语言文档格式.docx》由会员分享,可在线阅读,更多相关《仓库管理系统c语言文档格式.docx(32页珍藏版)》请在冰豆网上搜索。
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);
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);
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();
switch(a)
case1:
assistant(head);
break;
case2:
if(password())
b=menu2(h_p);
while(b!
=9);
default:
if(a!
=3)
return(a);
intmenu2(structshop**h_p)
intb;
chara;
print2();
b);
switch(b)
{
creat(h_p);
rewrite(h_p);
case3:
insert(h_p);
case4:
deleat(h_p);
case5:
search(h_p);
case6:
printall(h_p);
case7:
save(head);
case8:
password_set();
if(b!
=9)
\n保存吗?
(y/n):
"
%c"
if(a=='
y'
)
return(b);
voidauto1(structshop**h_p)
if(password_exi(h_p)&
&
data_exi(h_p))
load(h_p);
voidprint1(void)
********************************************************************************\n"
仓库管理系统\n"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
#*******************菜单*****************#\n"
#|1.员工模式|#\n"
#|2.店主模式|#\n"
#|3.退出|#\n"
#*********************************************#\n"
\n请选择(1-3):
voidassistant(structshop*head)
chara[50],c='
;
structshop*i;
i=head;
while(c=='
\n请输入卖出的商品名称:
\n"
gets(a);
\n请输入卖出的商品数量:
while(strcmp(i->
name,a)!
=0&
i->
next!
=NULL)
i=i->
next;
if(i->
num_now-=b;
win=(i->
num_in-i->
num_now)*(i->
price_out-i->
price_in);
else
\n此商品不存在或通知店主更新数据库\n"
\n继续吗?
c=getchar();
intpassword(void)
FILE*fp;
chara[50],b[50];
inti;
fp=fopen("
c:
\\y_secrea"
"
rb"
fscanf(fp,"
%s"
fclose(fp);
请输入密码:
i=0;
b[i]=getch();
*"
i++;
while(b[i-1]!
=13&
i<
19);
b[i-1]='
\0'
if(strcmp(a,b)==0)
return
(1);
return(0);
voidprint2(void)
店主模式\n"
#|1.新建2.修改|#\n"
#|3.插入4.删除|#\n"
#|5.查找6.查看|#\n"
#|7.保存8.改密|#\n"
#|9.上一层|#\n"
请选择(1-9):
voidcreat(structshop**h_p)
structshop*head,*i,*j;
intf=1;
n=0;
\n请输入数据若完成请在名称处输“0”.\n\n"
i=j=addbuild(&
head);
if(strcmp(i->
name,"
0"
)==0)
f=0;
while(f)
n++;
if(n==1)
head=j;
f=1;
\n请输入下一种货物的数据.\n\n"
i=addbuild(&
free(i);
j->
next=i;
j=i;
next=NULL;
*h_p=head;
voidrewrite(structshop**h_p)
chara[30];
structshop*i,*j,*head;
\n请输入要修改货物的名称:
if(n>
=1&
!
search1(h_p,a))
\n不存在的货物名称!
if(head==NULL)gotoend;
while(n>
search1(h_p,a));
while(strcmp(a,i->
name)!
if(strcmp(a,i->
name)==0)
printf("
\n真的要修改吗?
?
putchar('
if(getchar()=='
getchar();
j=addbuild(h_p);
strcpy(i->
name,j->
name);
price_in=j->
price_in;
price_out=j->
price_out;
num_in=j->
num_in;
num_now=j->
num_now;
num_sold=j->
num_sold;
win=j->
win;
percent=j->
percent;
free(j);
\n修改完成^_^\n\n"
}
}end:
voidinsert(structshop**h_p)
structshop*i,*j,*x,*head;
x=addbuild(h_p);
i=j=head;
name,x->
name)<
0&
j=i;
i=i->
if(strcmp(i->
name)>
=0)
if(i==head)
head=x;
else
j->
next=x;
x->
i->
\n插入完成^_^\n\n."
voiddeleat(structshop**h_p)
structshop*i,*j,*head;
chara[30],b;
\n请输入你要删除的货物的名称:
\n真的要删除吗?
b=getchar();
if(b=='
name,a)==0)
head=i->
free(i);
next=i->
n--;
\n删除完成^_^.\n\n"
*h_p=head;
end:
voidsearch(structshop**h_p)
intbegin,end,mid,t;
structshop*i,*head;
\n请输入要查询货物的名称:
while((strcmp(i->
=0)&
if((strcmp(i->
name,a)==0))
\n名称\t进价\t售价\t进货数目存货数目销量\t赢利\t利率\n"
\n===============================================================================\n"
%s%10.2f%10.2f%10d%10d%10d%9.2f%10.2f"
i->
name,i->
price_in,i->
price_out,i->
num_in
num_now,i->
num_sold,i->
win,i->
percent);
\n此货物不存在!
voidprintall(structshop**h_p)
inta,c;
charb='
while(b=='
print3();
a!
=2&
sort1(h_p);
sort2(h_p);
sort3(h_p);
for(c=1,i=*h_p;
=NULL;
next,c++)
\n名称\t进价\t售价\t进货数目存货数目销量\t赢利\t利率\t排名\n"
%s%10.2f%10.2f%10d%10d%10d%9.2f%10.2f%8d"
percent,c);
if(c%8==0)
按任意键继续。
。
查看其他排列方式?
voidsave(structshop*head)
FILE*fp;
attribc:
\\y_data-h"
delc:
\\y_data"
wb+"
for(i=head;
next)
fprintf(fp,"
%s%7.2f,%.2f,%d,%d,%d,%.2f,%.2f,"
\\y_data+h"
\n^_^已保存\n"
voidpassword_set()
inti,f=0,t=0;
chara[20],b[20];
请输入新密码(3~19位):
a[i]=getch();
while(a[i-1]!
a[i-1]='
\n请确认新密码:
if(strcmp(a,b)==0&
i>
2)
t=1;
\\y_secrea-h"
a);
fclose(fp