商品信息管理系统C语言课程设计Word文档格式.docx

上传人:b****7 文档编号:21995223 上传时间:2023-02-02 格式:DOCX 页数:19 大小:17.09KB
下载 相关 举报
商品信息管理系统C语言课程设计Word文档格式.docx_第1页
第1页 / 共19页
商品信息管理系统C语言课程设计Word文档格式.docx_第2页
第2页 / 共19页
商品信息管理系统C语言课程设计Word文档格式.docx_第3页
第3页 / 共19页
商品信息管理系统C语言课程设计Word文档格式.docx_第4页
第4页 / 共19页
商品信息管理系统C语言课程设计Word文档格式.docx_第5页
第5页 / 共19页
点击查看更多>>
下载资源
资源描述

商品信息管理系统C语言课程设计Word文档格式.docx

《商品信息管理系统C语言课程设计Word文档格式.docx》由会员分享,可在线阅读,更多相关《商品信息管理系统C语言课程设计Word文档格式.docx(19页珍藏版)》请在冰豆网上搜索。

商品信息管理系统C语言课程设计Word文档格式.docx

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

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 医药卫生 > 药学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1