商品信息管理系统C语言课程设计Word文档格式.docx
- 文档编号:21995223
- 上传时间:2023-02-02
- 格式:DOCX
- 页数:19
- 大小:17.09KB
商品信息管理系统C语言课程设计Word文档格式.docx
《商品信息管理系统C语言课程设计Word文档格式.docx》由会员分享,可在线阅读,更多相关《商品信息管理系统C语言课程设计Word文档格式.docx(19页珍藏版)》请在冰豆网上搜索。
voidsearch_option();
/*invokedofsearch*/
voidsearch_name();
main()
charchoose='
\0'
yes_no='
;
do
{
print_1();
choose=getch();
switch(choose)
{
case'
1'
:
create();
break;
/*createinformationofcommodity*/
2'
edit();
/*editinformationofcommodity*/
3'
show();
/*showinformationofcommodity*/
4'
search();
/*searchinformationofcommodity*/
0'
exit(0);
default:
printf("
\n%cisillegalityoption!
\n"
choose);
}
printf("
\nDoyouwanttocontinue(y/n)?
"
);
do
yes_no=getche();
}while(yes_no!
='
Y'
&
yes_no!
y'
N'
n'
}while(yes_no=='
||yes_no=='
}
voidprint_1()/*showlimitingsurfaceofmenu*/
clrscr();
/*clearnscreenoffunction*/
printf("
********************************************************************************\n"
**************Manage'
systemofCommodityInformation*************\n"
|***********************************************|\n"
|Pleaseinputoptionnumber|\n"
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|\n"
|1-----Createcommodityinformation|\n"
|2-----Editcommodityinformation|\n"
|3-----Showcommodityinformation|\n"
|4-----Searchcommodityinformation|\n"
|0-----Exitsystem|\n"
voidcreate()/*createinformationofcommodityforfunction*/
inti=0,j,num;
structcommoditytemp={0};
FILE*fp=NULL;
fp=fopen("
D:
\\commodity.txt"
"
w"
if(fp==NULL)
\nFileofinformationofcommodityopeningfailed.\n"
return;
}
Pleaseinputwanttoinputthenumberofgoods!
scanf("
%d"
&
num);
for(j=1;
num>
=j;
j++)
\nPleaseinput%drecord:
j);
number:
gets(temp.option);
}while(strcmp(temp.option,"
)==0);
name:
gets(temp.name);
price:
gets(temp.price);
production:
gets(temp.production_date);
stale_date:
gets(temp.stale_date);
finished_goods:
gets(temp.finished_goods);
saleroom:
gets(temp.saleroom);
fprintf(fp,"
%s%s%s%s%s%s%s\n"
temp.option,temp.name,temp.price,
temp.production_date,temp.stale_date,temp.finished_goods,temp.stale_date);
i++;
fclose(fp);
voidedit()/*editinformationofcommodityforfunction*/
pass[20]={0},old[20]={0},w;
inti=0,j,m=0;
FILE*fp_code;
fp_code=fopen("
\\code.txt"
r"
if(fp_code==NULL)
\nFileofcodeopeningfailed.\n"
fscanf(fp_code,"
%s"
old);
fclose(fp_code);
for(j=0;
j<
=2;
Intputpassword:
i=0;
w=getch();
if(w!
\r'
)
{
putch('
*'
pass[i]=w;
i++;
}
else
break;
}while
(1);
if(strcmp(pass,old)==0)
break;
else
printf("
\nYourcodeiswrong\n"
m++;
if(m>
=3)
exit
(1);
print_2();
"
edit_add();
/*addnewinformationofcommodity*/
edit_modify();
/*modifyinformationofcommodity*/
edit_delete();
/*deleteinformationofcommodity*/
voidprint_2()/*showlimitingsurfaceofmenu*/
|1-----Addcommodityinformation|\n"
|2-----Modifycommodityinformation|\n"
|3-----Deletecommodityinformation|\n"
voidedit_add()/*addnewinformationofcommodity*/
charc='
intn=0;
structcommoditytemp={0},record[N]={0},*p=NULL;
\nFileopeningfailed.\n"
return;
p=record;
while(feof(fp)==0)
fscanf(fp,"
%s%s%s%s%s%s%s"
p->
option,p->
name,p->
price,p->
production_date,p->
stale_date,
p->
finished_goods,p->
saleroom);
p++;
n++;
\nPleaseinputnewoption:
Pleaseinputnewname:
Pleaseinputnewprice:
Pleaseinputnewproduction:
Pleaseinputnewstale_date:
Pleaseinputnewfinished_goods:
Pleaseinputnewsaleroom:
for(p=record;
p<
record+n;
p++)
if(strcmp(temp.option,p->
option)==0)
printf("
\nTheoptionisrepeat,ifyouwanttoinputagain(y/n)?
do
{
c=getche();
}while(c!
c!
putchar('
\n'
if(p==record+n)
*p=temp;
}while(c=='
||c=='
for(p=record;
record+n+1;
\n%6s%10s%8s%8s%8s%8s%8s"
voidedit_modify()/*modifyinformationofcommodity*/
structcommodity*find=NULL,temp={0},record[100]={0},*p=NULL;
while(!
feof(fp))
if(n==0)
\nNorecordinthisfile.\n"
\nPleaseinputyouwanttocommodity'
option:
gets(temp.option);
if(strcmp(temp.option,p->
find=p;
if(p==record+n)
\nNothiscommodity.\n"
\nPleaseinputrightoption.:
Pleaseinputrightname:
Pleaseinputrightprice:
Pleaseinputrightproduction:
Pleaseinputrightstale_date:
Pleaseinputrightfinished_goods:
Pleaseinputrightsaleroom:
option)==0&
(p!
=find))
\nTheoptionisrepeat,doyouwanttocontinue?
(y/n)"
*find=temp;
}while((c=='
)||(c=='
));
\nFileopeningisfailed.\n"
voidedit_delete()/*deleteinformationofcommodity*/
\nAccordingtotheoption(o)todelete,deleteorbythename(n)?
c=getche();
if(c=='
o'
O'
delete_option();
else
if(c=='
delete_name();
\nThischarisillegal.\n"
voiddelete_option()/*deleteinformationofcommoditybyoption*/
chartempoption[10]="
structcommodityrecord[N]={0},*p=NULL,*k=NULL;
\nPleaseinputyouwanttodeletetheoption:
gets(tempoption);
for(k=record;
k<
k++)
if(strcmp(tempoption,k->
if(k<
record+n)
for(p=k;
k+n-1;
*p=*(p+1);
\nNosuchcommodify.\n"
\\commodi
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 商品信息 管理 系统 语言 课程设计
![提示](https://static.bdocx.com/images/bang_tan.gif)