实验室设备管理系统设计.docx
《实验室设备管理系统设计.docx》由会员分享,可在线阅读,更多相关《实验室设备管理系统设计.docx(42页珍藏版)》请在冰点文库上搜索。
实验室设备管理系统设计
1.设计课题内容
实验设备管理系统设计
实验设备信息包括:
设备编号,设备种类(如:
微机、打印机、扫描仪等等),设备名称,设备价格,设备购入日期,是否报废,报废日期等.
主要功能:
1、能够完成对设备地录入和修改.
2、对设备进行分类统计.
3、设备地破损耗费和遗损处理.
4、设备地查询.
2.应用程序地详细功能说明
该实验设备管理系统采用纯C语言编写,使用者能实验该管理系统方便、直观地对实验设备进行管理操作,如对实验设备信息地录入、实验设备信息地修改、查询需要地目标设备地信息并对其进行统计等等.
程序分两大系统,一是管理系统,二是查询系统.
在管理系统中
1.建立链表储存设备信息:
:
输入新地设备信息,若当前设备管理系统中地设备还未录入时,建立新地链表来储存当前输入地设备信息,并返回链表地头指针指向第一个输入地设备地信息.
2.插入新地设备信息:
输入新地设备信息,且当前设备管理系统中地链表非空,则将新地设备信息插入链表,并返回链表头指针.
3.修改设备信息:
若对已有地设备地信息需要修改,则按设备编号进行查找,在成功找到该设备时,并选择需要修改地信息进行修改.
4.删除设备信息:
若已有设备地信息错误或该设备不可用即已经报废,则要对该条信息进行删除处理.
5.对设备进行遗损处理:
当设备将要报废或已报废时则删除该设备地相关信息,并通知.
在查询系统中
1.查找设备信息:
当需要查看已有地设备信息对设备进行进一步地管理和维护时,就可按设备编号、设备类型、设备名称、设备购入价格、设备购入时间、设备报废时间、设备是否可用对已有设备信息进行检索,同时也可选择查看所有设备信息.并且能在程序地根目录下地result.txt文件中查看信息.
3.输入数据类型、格式和内容控制
输入实验设备地信息:
设备编号为整形;
设备类型为10个字符;
设备名称为20个字符;
设备购入价格为浮点型,输出时保留一位小数;
设备购入时间为整形
设备报废时间为整形;
设备是否可用为整形,记0为不可用,1为可用;
4.主要模块地算法描述
4.1简单算法描述
1.新地设备信息添加到链表
2.删除错误和无用地设备信息
3.查找所需相关类型信息地设备信息
4.修改设备信息
建立带头节点地链表
4.2流程图显示
5.结束语
在课程设计中,我体会颇多,学到很多东西.我加强了对C地认识,复习了自己以前地知识,自己地逻辑思考能力也提高不少.从而对MicrosoftVisualC++6.0开发环境又有了更深入地认识!
在这次课程设计中,我还总结了程序开发地一些比较重要地步骤,比如需求分析、总体设计、数据库设计(含概念设计、逻辑设计、物理设计)、程序模块设计(含功能需求、用户界面设计、程序代码设计与分析、运行结果)、系统使用说明等.这次课程设计激发了我对编程地兴趣和热情,让我从一个只懂理论变成了能做一些小型程序地人,使我对编程更加热爱了.在这次地课程设计中我考虑了很多地东西,产生了许多地问题,通过对资料地查找和筛选,我也找到了这些问题地解决办法,这使我有了很大地成就感,让我对编写程序有了更浓烈地兴趣和信心.相信在以后地设计中我会提交出更加优秀地作品!
6.课程设计源程序清单
#include
#include
#include
#include
#include
#defineSIZEsizeof(structShiyanEquip)
structShiyanEquip{
intnum。
chartype[10],name[20]。
doubleprice。
intbtime。
intotime。
intable。
structShiyanEquip*next。
}。
//============================================================函数声明
structShiyanEquip*NewList()。
structShiyanEquip*InsertNode(structShiyanEquip*head,structShiyanEquip*newin)。
voidSearchNode(structShiyanEquip*head)。
voidSearchNode_num(structShiyanEquip*head,intnum)。
voidSearchNode_type(structShiyanEquip*head,chartype[])。
voidSearchNode_name(structShiyanEquip*head,charname[])。
voidSearchNode_price(structShiyanEquip*head,doubleprice)。
voidSearchNode_btime(structShiyanEquip*head,intbtime)。
voidSearchNode_otime(structShiyanEquip*head,intotime)。
voidSearchNode_able(structShiyanEquip*head,intable)。
structShiyanEquip*Delete_num(structShiyanEquip*head,intnum)。
voidChangeNode(structShiyanEquip*head,intnum)。
voidDealwithpass(structShiyanEquip*head,intnowtime)。
structShiyanEquip*manage()。
voidsearch(structShiyanEquip*head)。
staticcount=0。
intmain(void)
{
structShiyanEquip*head=NULL。
charchose。
do
{
printf("********Wlecometousemyprogram~********\n\n")。
printf("**********HereistheMenu**********\n")。
printf("*No.1:
管理系统*\n")。
printf("*No.2:
查询系统*\n")。
printf("*No.#:
退出系统*\n")。
printf("*******************************************\n")。
scanf("%s",&chose)。
switch(chose)
{
case'1':
head=manage()。
break。
case'2':
search(head)。
break。
case'#':
system("cls")。
printf("********Thankyouforusingmyprogram~********\n\n")。
exit(0)。
}
}while
(1)。
return0。
}
//====================================================管理系统
structShiyanEquip*manage()
{
charchose2。
intnum,nowtime。
chartype[10],name[20]。
doubleprice。
intbtime。
intotime。
intable。
structShiyanEquip*pcurr,*head。
system("cls")。
do{
system("cls")。
printf("**********管理系统**********\n")。
printf("**No.1:
建立新实验器材管理清单**\n")。
printf("**No.2:
插入新地实验器材**\n")。
printf("**No.3:
删除目标器材信息**\n")。
printf("**No.4:
修改目标器材信息**\n")。
printf("**No.5:
遗损处理**\n")。
printf("**No.#:
返回上级菜单**\n")。
printf("********************************\n")。
scanf("%s",&chose2)。
switch(chose2)
{
case'1':
head=NewList()。
break。
case'2':
pcurr=(structShiyanEquip*)malloc(SIZE)。
printf("=输入实验器材地编号,类型,名称,价格,购入时间,报废时间,是否可用(0:
报废。
1:
可用)=\n")。
scanf("%d%s%s%lf%d%d%d",&num,type,name,&price,&btime,&otime,&able)。
pcurr->num=num。
strcpy(pcurr->type,type)。
strcpy(pcurr->name,name)。
pcurr->price=price。
pcurr->btime=btime。
pcurr->otime=otime。
pcurr->able=able。
head=InsertNode(head,pcurr)。
break。
case'3':
printf("=请输入要删除地实验器材地编号=:
")。
scanf("%d",&num)。
head=Delete_num(head,num)。
break。
case'4':
printf("=请输入要修改地实验器材地编号=:
")。
scanf("%d",&num)。
ChangeNode(head,num)。
break。
case'5':
printf("=请输入现在地日期=")。
scanf("%d",nowtime)。
Dealwithpass(head,nowtime)。
break。
case'#':
system("cls")。
returnhead。
}
}while
(1)。
returnhead。
}
structShiyanEquip*NewList()//=====================================新建链表
{
intnum。
chartype[10],name[20]。
doubleprice。
intbtime。
intotime。
intable。
structShiyanEquip*p,*head,*tail。
head=tail=NULL。
printf("录入实验器材地信息.....\n")。
printf("=输入实验器材地编号,类型,名称,价格,购入时间,报废时间,是否可用(0:
报废。
1:
可用)=\n")。
scanf("%d%s%s%lf%d%d%d",&num,type,name,&price,&btime,&otime,&able)。
while(num!
=0)
{
p=(structShiyanEquip*)malloc(SIZE)。
p->num=num。
strcpy(p->type,type)。
strcpy(p->name,name)。
p->price=price。
p->btime=btime。
p->otime=otime。
p->able=able。
p->next=NULL。
if(head==NULL)
head=p。
else
tail->next=p。
tail=p。
printf("=输入实验器材地编号,类型,名称,价格,购入时间,报废时间,是否可用(0:
报废。
1:
可用)=\n")。
scanf("%d%s%s%lf%d%d%d",&num,type,name,&price,&btime,&otime,&able)。
}
returnhead。
}
structShiyanEquip*InsertNode(structShiyanEquip*head,structShiyanEquip*newin)
//插入节点
{
structShiyanEquip*pt1,*pt2。
pt1=head。
pt2=newin。
if(head==NULL)
{
head=pt2。
head->next=NULL。
count++。
}else
{
pt2->next=pt1->next。
pt1->next=pt2。
count++。
}
returnhead。
}
structShiyanEquip*Delete_num(structShiyanEquip*head,intnum)//======删除节点
{
structShiyanEquip*pt1,*pt2。
if(head==NULL)
returnNULL。
else
{
if(head->num==num)
{
pt2=head。
head=head->next。
free(pt2)。
count--。
returnhead。
}else
{
pt1=head。
pt2=head->next。
if(pt2!
=NULL)
{
if(pt2->num==num)
{
pt1->next=pt2->next。
free(pt2)。
count--。
}else
{
pt1=pt2。
pt2=pt1->next。
}
}
}
}
returnhead。
}
voidChangeNode(structShiyanEquip*head,intnum)//===================更改节点
{
chartype[10],name[20]。
doubleprice。
intbtime。
intotime。
intable。
intflag=0,chose4。
structShiyanEquip*pt。
if(head==NULL)
{
printf("=抱歉,没有任何信息!
=\n")。
return。
}
for(pt=head。
pt。
pt=pt->next)
if(pt->num==num)
{
printf("====选择要修改地信息====\n")。
printf("=1.编号=\n")。
printf("=2.类型=\n")。
printf("=3.名称=\n")。
printf("=4.价格=\n")。
printf("=5.购入时间=\n")。
printf("=6.报废时间=\n")。
printf("=7.是否可用=\n")。
switch(chose4)
{
case1:
printf("=请输入新地信息=")。
scanf("%d",&num)。
pt->num=num。
break。
case2:
printf("=请输入新地信息=")。
scanf("%s",&type)。
strcpy(pt->type,type)。
break。
case3:
printf("=请输入新地信息=")。
scanf("%s",&name)。
strcpy(pt->name,name)。
break。
case4:
printf("=请输入新地信息=")。
scanf("%lf",&price)。
pt->price=price。
break。
case5:
printf("=请输入新地信息=")。
scanf("%d",&btime)。
pt->btime=btime。
break。
case6:
printf("=请输入新地信息=")。
scanf("%d",&otime)。
pt->otime=otime。
break。
case7:
printf("=请输入新地信息=")。
scanf("%d",&able)。
pt->able=able。
break。
}
}
}
//===========================================================查询系统
voidsearch(structShiyanEquip*head)
{
intnum。
chartype[10],name[20]。
doubleprice。
intbtime。
intotime。
intable。
charchose3。
system("cls")。
do{
system("cls")。
printf("**********查询系统**********\n")。
printf("**No.1:
按编号查找**\n")。
printf("**No.2:
查找统一价格**\n")。
printf("**No.3:
查找同一类型**\n")。
printf("**No.4:
查找同一名称**\n")。
printf("**No.5:
查找按购入日期**\n")。
printf("**No.6:
查找按报废日期**\n")。
printf("**No.7:
查找按是否可用**\n")。
printf("**No.8:
显示全部器材信息**\n")。
printf("**No.#:
返回上一级菜单**\n")。
printf("********************************\n")。
scanf("%s",&chose3)。
switch(chose3)
{
case'1':
printf("=请输入要查找地编号=")。
scanf("%d",&num)。
SearchNode_num(head,num)。
break。
case'2':
printf("=请输入想要查看地价格=")。
scanf("%lf",&price)。
SearchNode_price(head,price)。
break。
case'3':
printf("=请输入想要查找地类型=")。
scanf("%s",type)。
SearchNode_type(head,type)。
break。
case'4':
printf("=请输入想要查看地名称=")。
scanf("%s",name)。
SearchNode_name(head,name)。
break。
case'5':
printf("=请输入想要查看地购入时间=")。
scanf("%d",&btime)。
SearchNode_btime(head,btime)。
break。
case'6':
printf("=请输入想要查看地报废时间=")。
scanf("%d",&otime)。
SearchNode_otime(head,otime)。
break。
case'7':
printf("=请输入要查看是否可用地器材(0:
报废。
1:
可用)=")。
scanf("%d",&able)。
SearchNode_able(head,able)。
break。
case'8':
SearchNode(head)。
break。
case'#':
system("cls")。
return。
}
}while
(1)。
}
voidSearchNode_num(structShiyanEquip*head,intnum)//按编号查找
{
FILE*fp。
if((fp=fopen("result.txt","w"))==NULL)
{
printf("===文件打开错误!
===\n")。
exit(0)。
}
intflag=0。
structShiyanEquip*pt。
if(head==NULL)
{
printf("=抱歉,没有任何信息!
=\n")。
for(inti=5。
i>0。
i--)
{
printf("%d秒后请重新操作\n",i)。
Sleep(1000)。
}
return。
}
for(pt=head。
pt。
pt=pt->next)
if(pt->num==num)
{
flag=1。
printf("=============================\n")。
printf("=编号%d\n",pt->num)。
printf("=类型%s\n",pt->type)。
printf("=名称%s\n",pt->name)。
printf("=价格%.1lf\n",pt->price)。
printf("=购入时间%d\n",pt->btime)。
printf("=报废时间%d\n",pt->otime)。
printf("=是否可用%d\n",pt->able)。
printf("=============================\n")。
fprintf(fp,"