C语言药房管理系统Word文件下载.docx

上传人:wj 文档编号:1450008 上传时间:2023-04-30 格式:DOCX 页数:17 大小:15.42KB
下载 相关 举报
C语言药房管理系统Word文件下载.docx_第1页
第1页 / 共17页
C语言药房管理系统Word文件下载.docx_第2页
第2页 / 共17页
C语言药房管理系统Word文件下载.docx_第3页
第3页 / 共17页
C语言药房管理系统Word文件下载.docx_第4页
第4页 / 共17页
C语言药房管理系统Word文件下载.docx_第5页
第5页 / 共17页
C语言药房管理系统Word文件下载.docx_第6页
第6页 / 共17页
C语言药房管理系统Word文件下载.docx_第7页
第7页 / 共17页
C语言药房管理系统Word文件下载.docx_第8页
第8页 / 共17页
C语言药房管理系统Word文件下载.docx_第9页
第9页 / 共17页
C语言药房管理系统Word文件下载.docx_第10页
第10页 / 共17页
C语言药房管理系统Word文件下载.docx_第11页
第11页 / 共17页
C语言药房管理系统Word文件下载.docx_第12页
第12页 / 共17页
C语言药房管理系统Word文件下载.docx_第13页
第13页 / 共17页
C语言药房管理系统Word文件下载.docx_第14页
第14页 / 共17页
C语言药房管理系统Word文件下载.docx_第15页
第15页 / 共17页
C语言药房管理系统Word文件下载.docx_第16页
第16页 / 共17页
C语言药房管理系统Word文件下载.docx_第17页
第17页 / 共17页
亲,该文档总共17页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

C语言药房管理系统Word文件下载.docx

《C语言药房管理系统Word文件下载.docx》由会员分享,可在线阅读,更多相关《C语言药房管理系统Word文件下载.docx(17页珍藏版)》请在冰点文库上搜索。

C语言药房管理系统Word文件下载.docx

\t\t\t6.删除药品信息\n"

\t\t\t7.退出\n"

\t\t------------------------------------------\n\n"

do{

printf("

Enteryouchoice(1~7):

"

scanf("

%s"

s);

a=atoi(s);

}

while(a<

1||a>

7);

returna;

}

intaddmedicine()

\t\t\t--------------请输入您要保存的信息------------\n"

\t\t\t输入药品名称:

\n"

scanf("

medicine[num].name);

\t\t\t输入药品编号:

medicine[num].number);

\t\t\t单价:

medicine[num].price);

printf("

\t\t\t品牌:

medicine[num].brand);

\t\t\t库存数量:

medicine[num].inventory);

num++;

\t\t\t是否继续添加?

(Y/N):

if(getch()=='

y'

||getch()=='

Y'

addmedicine();

return(0);

voidmodifybyname()//按药品名称修改

charc;

inti,mark=0;

charname[20];

printf("

\n\t\t请输入要修改的药品名称:

scanf("

name);

if(num==0)

{

\n\t\t文件中无相关药品"

\n\t\t按任意键返回主菜单"

getch();

mark++;

return;

}

for(i=0;

i<

num;

i++)

{

if(strcmp(medicine[i].name,name)==0)

printf("

\n\t\t以下是您要修改的药品信息"

\n\t\t药品名称:

%s"

medicine[i].name);

\n\t\t药品编号:

medicine[i].number);

\n\t\t单价:

medicine[i].price);

printf("

\n\t\t品牌:

medicine[i].brand);

\n\t\t库存数量:

medicine[i].inventory);

\n\t\t是否修改(y/n)"

if(getch()=='

{

printf("

\n\t----------------------请选择修改信息-------------------------"

\n\t1-修改药品名称"

\n\t2-修改药品编号"

\n\t3-修改单价"

printf("

\n\t4-修改品牌"

\n\t5-修改库存数量"

\n\t--------------------------------------------------------------------------"

\n\t请选择您所要的服务:

scanf("

&

c);

switch(c)

{

case'

1'

:

printf("

\n\t请输入新药品名称:

"

scanf("

break;

case'

2'

printf("

\n\t请输入新药品编号:

3'

\n\t请输入新单价:

case'

4'

\n\t请输入新品牌:

5'

\n\t请输入新库存数量:

}

}

}

if(mark==0)

printf("

\n\t\t药品信息修改完毕"

\n\t是否继续修改?

if(getch()=='

modifybyname();

return;

}

voidlist()

inti;

if(num!

=0)

{

printf("

\t\t\t----------已为您显示所有药品信息----------\n"

for(i=0;

{

printf("

\t\t\t药品名称:

%s\n"

\t\t\t药品编号:

\t\t\t单价:

printf("

%s\n"

\t\t\t库存数量:

if(i+1<

num)

{

system("

pause"

}

}

\t\t\t------------------------------\n"

else

\t\t\t系统中无任何记录\n"

\t\t\t按任意键返回主菜单:

getch();

return;

intsearchbyname()

intmark=0;

\t\t\t----------按药品名称查找----------\n"

charname[20];

\t\t\t请输入药品名称:

for(i=0;

if(strcmp(medicine[i].name,name)==0)

{

\t\t\t-------以下是您查找的药品信息-------\n"

%s"

\t\t\t------------------------------------------------------\n"

mark++;

if((i+1)<

printf("

\t\t\t是否继续查找相同名称的药品信息:

(y/n)\n"

if(getch()=='

{

continue;

}

else

return(0);

}

else

\t\t\t请按任意键返回主菜单"

getch();

return(0);

}

if(mark==0)

printf("

\t\t\t没有您要查找的药品记录\n"

\t\t\t请按任意键返回主菜单\n"

getch();

return(0);

return0;

intsearchbynumber()

intmark=0;

inti;

\t\t\t---------------按药品编号查找--------------\n"

charnumber[10];

\t\t\t请输入药品编号:

scanf("

number);

if(strcmp(medicine[i].number,number)==0)

\t\t\t---------------以下是您查找的药品信息---------------\n"

printf("

\t\t\t-------------------------------------------------\n"

mark++;

return(0);

}

if(mark==0)

\t\t\t没有改药品的信息\n"

getch();

return(0);

voiddeletebynumber()

inti,j;

intdeletemark=0;

charnumber[20];

\t\t\t请输入要删除药品编号:

if(num==0)

\t\t\t对不起,系统中无任何记录\n"

return;

for(i=0;

if(strcmp(medicine[i].number,number)==0)

{

printf("

\t\t\t以下是您要删除的用户记录:

printf("

printf("

\t\t\t是否删除?

(y/n)"

if(getch()=='

{

for(j=i;

j<

num-1;

j++)

medicine[j]=medicine[j+1];

num--;

deletemark++;

printf("

\t\t\t删除成功"

\t\t\t是否继续删除?

if(getch()=='

deletebynumber();

return;

}

else

return;

continue;

if(deletemark==0)

\t\t\t没有该药品的记录"

if(getch()=='

deletebynumber();

return;

}

voiddeletebyname()

inta=0;

intfindmark=0;

intj;

\t\t\t请输入要删除药品名称:

for(i=a;

if(strcmp(medicine[i].name,name)==0)

\t\t\t以下是您要删除的药品信息:

findmark++;

\t\t\t________________________________"

printf("

if(getch()=='

||getch()=='

for(j=i;

medicine[j]=medicine[j+1];

num--;

deletemark++;

if((i+1)<

printf("

\t\t\t是否继续删除相同名称的药品信息?

if(getch()=='

a=i;

continue;

deletebyname();

else

continue;

if((deletemark==0)&

&

(findmark==0))

deletebynumber();

elseif(findmark!

\t\t\t没有重名信息"

deletebynumber();

intdele()//删除记录

charchoic;

\t\t\t1-按药品编号删除2-按药品名称删除"

\t\t\t请选择:

choic=getch();

switch(choic)

case'

deletebynumber();

deletebyname();

intsortbyprice()//按药品单价进行排序

inti,j;

structmedicinetmp;

for(i=1;

if(strcmp(medicine[i].price,medicine[i-1].price)<

0)

tmp=medicine[i];

j=i-1;

do

medicine[j+1]=medicine[j];

j--;

}while((strcmp(tmp.price,medicine[j].price)<

0&

j>

=0));

medicine[j+1]=tmp;

\t\t\t排序成功,是否显示?

if(getch()=='

list();

intmain()

printf("

\t\t---------------------------------------------------------\n"

\t\t---------Welcometomanagementsystem----------\n"

\t\t----------MadeBy蒋俊杰李梁伟郑奈春-------------\n"

请按任意键进入主菜单:

)\n"

getch();

intselectnum;

while

(1)

{

selectnum=menu_select();

switch(selectnum)

{

case1:

addmedicine();

//添加药品信息

break;

case2:

list();

break;

case3:

modifybyname();

//修改药品信息

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

当前位置:首页 > PPT模板 > 商务科技

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2