实验设备信息管理系统——c语言

上传人:第*** 文档编号:34730857 上传时间:2018-02-28 格式:DOC 页数:16 大小:162KB
返回 下载 相关 举报
实验设备信息管理系统——c语言_第1页
第1页 / 共16页
实验设备信息管理系统——c语言_第2页
第2页 / 共16页
实验设备信息管理系统——c语言_第3页
第3页 / 共16页
实验设备信息管理系统——c语言_第4页
第4页 / 共16页
实验设备信息管理系统——c语言_第5页
第5页 / 共16页
点击查看更多>>
资源描述

《实验设备信息管理系统——c语言》由会员分享,可在线阅读,更多相关《实验设备信息管理系统——c语言(16页珍藏版)》请在金锄头文库上搜索。

1、实验设备信息管理系统 题目要求: 实验设备信息包括:设备编号,设备种类(如微机,打印机,扫描仪等) , 设备名称,设备价格,设备购入日期,是否报废,报废日期等。试设计一实 验设备信息管理系统,使之能提供以下功能: 1. 能够完成对设备的录入和修改。 2. 对设备进行分类统计。 3. 设备的查询。 需求分析: 实验室设备信息用文件储存,提供文件的输入输出操作;要能够完成设备的录 入和修改工作,需要添加设备的添加和修改操作;实现对设备进行分类统计, 需要提供排序操作;实现对设备的查询需要提供查找操作,设备的查询可根据 设备编号,设备种类,设备名称,设备购入日期等多种方式查询;另外还要提 供键盘式选

2、择菜单以实现选择功能。 总体设计: 试验设备信息添加输入模块,试验设备信息修改模块,实验设备信息统计模块 和试验设备信息查询模块。 建立试验设备信息结构体,结构体成员包括设备编号,设备种类,设备名称, 设备价格,设备购入日期,是否报废,报废日期。我的程序设计如下: #include #include #include #define N 50 void menu(); void add(); void modify(); void stat(); void search(); int load(); struct equipmentchar num10; /*设备编号*/char kind10

3、; /*设备种类*/char name10; /*设备名称*/char money10; /*设备价格*/char brithday10; /*设备日期*/char bf10; /*是否报废*/char badday10; /*报废日期*/eupN,temp; /* 返回主函数模块 */ void menu()int n;puts(“tt*MENU*nn“);puts(“tttt 1.tianjia shiyan “);puts(“tttt 2.xiugai“);puts(“tttt 3.tongji“);puts(“tttt 4.chaxun“);puts(“tttt 5.EXIT“);pu

4、ts(“nntt* *n“);printf(“please choice(1-5): bb“);scanf(“%d“,switch(n)case 1:add();break;case 2:modify();break;case 3:stat();break;case 4:search();break;case 5:exit(0);default:menu(); void main()/*主函数*/ menu();getch(); /* 追加模块 */ void add() int i;FILE *fp;fp=fopen(“eup.txt“,“a“);if(fp=fopen(“eup.txt“,

5、“a“)=NULL)printf(“cannot open filen“); printf(“nshuru:numtkindtnametmoneytbrithdaytbftbaddayn“);scanf(“%s“,temp.num);scanf(“%s“,temp.kind); scanf(“%s“,temp.name);scanf(“%s“,temp.money);scanf(“%s“,temp.brithday);scanf(“%s“,temp.bf);scanf(“%s“,temp.badday);fprintf(fp,“n%st%st%st%st%st%st%s“,temp.num,t

6、emp.kind,temp.nam e,temp.money,temp.brithday,temp.bf,temp.badday);fclose(fp);printf(“nntSuccessful._nn“);printf(“n* *n“);printf(“What do you want to do?nn“);printf(“t1.Continue to addt2.Back to main menut3.Exitn“);printf(“n* *n“);printf(“nnInput your choice(1-3):“);scanf(“%d“,if(i=1)add();if(i=2) me

7、nu();if(i=3)exit(0); /* 修改模块 */ void modify() FILE *fp;int n,k=0,b,c,i,e;char a10;n=load();for(i=0;in;i+)printf(“%st%st%st%st%st%st%sn“,eupi.num,eupi.kind,eupi.n ame,eupi.money,eupi.brithday,eupi.bf,eupi.badday);printf(“nInput the shebei number you want to modify!nnThe equ number:“);scanf(“%s“,a);fo

8、r(i=0;in;i+)if(strcmp(a,eupi.num)=0) /*查找要修改的设备信息*/k=1;c=i;break;if(k=0)printf(“nnsorry meiyou zhaodao!“);printf(“t1).zaici chazhao 2).fanhui MENU bb“);scanf(“%d“,if(b=1)modify();if(b=2)menu();if(k=1)printf(“nFind the shebei!n“);printf(“nPlease input the new information:n“);printf(“nnum kind name mo

9、ney brithday bf baddayn“);scanf(“%s“,eupc.num);scanf(“%s“,eupc.kind);scanf(“%s“,eupc.name);scanf(“%s“,eupc.money);scanf(“%s“,eupc.brithday);scanf(“%s“,eupc.bf);scanf(“%s“,eupc.badday);fp=fopen(“eup.txt“,“w“);for(i=0;in;i+)fprintf(fp,“%st%st%st%st%st%st%sn“,eupi.num,eupi.kind,eup i.name,eupi.money,eu

10、pi.brithday,eupi.bf,eupi.badday);fclose(fp);printf(“nntSuccessful._nn“);printf(“n* *n“);printf(“What do you want to do?nn“);printf(“t1.Continue to modifyt2.Back to main menut3.Exitn“);printf(“n* *n“);printf(“nnInput your choice(1-3):“);scanf(“%d“,if(e=1)modify();if(e=2) menu();if(e=3)exit(0); /* 分类统

11、计模块 */ void stat() int n,i;FILE *fp;fp=fopen(“eup.txt“,“r“);if(fp=fopen(“eup.txt“,“r“)=NULL)printf(“cannot open filen“); while(!feof(fp)fscanf(fp,“n%s %s %s %s %s %s %s“,temp.num,temp.kind,temp.name,temp.money,temp.brithday,temp.bf,tem p.badday);printf(“n%st%st%st%st%st%st%s“,temp.num,temp.kind,temp.name,te mp.money,temp.brithday,temp.bf,temp.badday);fclose(fp);menu();

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 解决方案

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号