C语言课程设计报告—机房机位预约模拟系统方案

上传人:xmg****18 文档编号:120419654 上传时间:2020-02-06 格式:DOC 页数:25 大小:76KB
返回 下载 相关 举报
C语言课程设计报告—机房机位预约模拟系统方案_第1页
第1页 / 共25页
C语言课程设计报告—机房机位预约模拟系统方案_第2页
第2页 / 共25页
C语言课程设计报告—机房机位预约模拟系统方案_第3页
第3页 / 共25页
C语言课程设计报告—机房机位预约模拟系统方案_第4页
第4页 / 共25页
C语言课程设计报告—机房机位预约模拟系统方案_第5页
第5页 / 共25页
点击查看更多>>
资源描述

《C语言课程设计报告—机房机位预约模拟系统方案》由会员分享,可在线阅读,更多相关《C语言课程设计报告—机房机位预约模拟系统方案(25页珍藏版)》请在金锄头文库上搜索。

1、下载可编辑程序设计报告设计者:肖昊班级序号:055071-27学号:20071003651指导老师:刘文中C语言程序设计编程实践是学习C语言程序设计的一重要环节,为提高学生程序设计能力,通过课堂和上机实践练习使学生的程序设计能力上一台阶。通过前四单元温顾而知新、庖丁解牛、举一反三、熟能生巧等过程的练习设计下面一个完整的程序1. 题目要求设计“机房机位预约模拟系统”要求:20台机器,从早8点到晚8点,每两个小时一个时间段。 需要实现功能: 1,查询,根据输入时间,输出机位信息。 2,即为预定,根据输入的日期和时间段查询是否有空机位,若有则预约,若无则提供最近空机时间段。另:若用户要求在非空时间上

2、机,则将用户信息插入该时间段的等待列表. 3,退出预定,根据输入的时间,撤销该时间的预定。 4,查询是否有等待的信息,若有则按顺序显示联系方式,若无则显示提示信息。 2需求分析根据题目要求在程序中需实现查询,预定,排队等功能的操作,所以需要建立相应的模块来实现;另外还需提供键盘式选择菜单实现功能,在运行时达到所要目的。 3总体设计整个系统可分为3个模块 查询模块 预定模块 取消模块机房机位预约模拟系统查询模块预定模块取消模块 详细设计 主函数比较简洁,只提供输入、功能处理和输出部分的函数调用。 显示一系列功能选择输入n,判断m 是否是0到6?根据n值调用各功能模块函数结束N开始main() i

3、nt i; for(i=0;i=8&nnext!=NULL;Rem=Rem-next) if(strcmp(Rem-data,Infor)=0)break; if(Rem-locat!=0) printf(The computer number is %dn,Rem-locat); else printf(对不起.你依旧在等待列表中或者没有预定); else printf(错误,请再次输入.n); void inquir() int n; printf(输入想要查询的时间(24 hours 820oclock,include 8 oclock)n); scanf(%d,&n); if(n=8&

4、n20) n=S(n); if(TimeQueuen.CNum=8&n20) n=S(n); if(TimeQueuen.CNumlocat=1; strcpy(Rem-data,Infor); Rem-next=NULL; TimeQueuen.first=Rem; TimeQueuen.last=Rem; TimeQueuen.CNum+; printf(成功预定n); else Rem=(struct node *)malloc(sizeof(struct node); strcpy(Rem-data,Infor); Rem-next=NULL; p=TimeQueuen.last; R

5、em-locat=TimeQueuen.CNum+1; printf(%d,Rem-locat); TimeQueuen.last=Rem; p-next=Rem; TimeQueuen.CNum+; printf(成功预定n); else printf(没有空余机位!); else printf(错误.请再次输入.n); void waiting() int n; char Infor10; struct node *Rem; struct node *p; printf(请输入想要排队的时间n); scanf(%d,&n); if(n=8&n=MAX) printf(请输入你的学号n);

6、scanf(%s,Infor); if(TimeQueuen.CNum)=MAX) Rem=(struct node *)malloc(sizeof(struct node); strcpy(Rem-data,Infor); Rem-next=NULL; Rem-locat=0; p=TimeQueuen.last; TimeQueuen.last=Rem; p-next=Rem; TimeQueuen.middle=Rem; TimeQueuen.CNum+; printf(成功排队n); else Rem=(struct node *)malloc(sizeof(struct node);

7、 strcpy(Rem-data,Infor); Rem-next=NULL; Rem-locat=0; p=TimeQueuen.last; TimeQueuen.last=Rem; p-next=Rem; TimeQueuen.CNum+; printf(成功排队n); else printf(有空余机位,无须等待n); else printf(错误.再次输入.n); 取消模块 开始输入预定时间 判断是否预定与排队成功取消预定结束N void cancel() int n; int i; char Infor10; struct node *Rem; struct node *q; str

8、uct node *p; printf(请输入预定的时间n); scanf(%d,&n); if(n=8&nnext,i+) if(strcmp(Rem-data,Infor)=0)break; if(iMAX) if(Rem-next=NULL) q-next=NULL; TimeQueuen.last=q; free(Rem); TimeQueuen.CNum-; printf(Succeed to out the queue!n); else q-next=Rem-next; free(Rem); TimeQueuen.CNum-; printf(Succeed to out the q

9、ueue!n); else if(TimeQueuen.CNumMAX) TimeQueuen.middle-locat=Rem-locat; TimeQueuen.middle=TimeQueuen.middle-next; if(i=1) TimeQueuen.first=Rem-next; else q-next=Rem-next; free(Rem); TimeQueuen.CNum-; printf(成功取消预定!n);附录源代码:#include #include #include #define LENGTH 6 #define MAX 20 #define S(r) (r-8)/2 #define NULL 0 struct

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 大杂烩/其它

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