1、2,即为预定,根据输入的日期和时间段查询是否有空机位,若有则预约,若无则提供最近空机时间段。另:若用户要求在非空时间上机,则将用户信息插入该时间段的等待列表. 3,退出预定,根据输入的时间,撤销该时间的预定。4,查询是否有等待的信息,若有则按顺序显示联系方式,若无则显示提示信息。 2需求分析根据题目要求在程序中需实现查询,预定,排队等功能的操作,所以需要建立相应的模块来实现;另外还需提供键盘式选择菜单实现功能,在运行时达到所要目的。 3总体设计整个系统可分为3个模块 查询模块 预定模块 取消模块 详细设计 主函数比较简洁,只提供输入、功能处理和输出部分的函数调用。main() int i;fo
2、r(i=0;i=8&nnext!=NULL;Rem=Rem-next) if(strcmp(Rem-data,Infor)=0)break;if(Rem-locat!=0) The computer number is %dn,Rem-locat);else printf(对不起.你依旧在等待列表中或者没有预定错误,请再次输入.nvoid inquir() 输入想要查询的时间(24 hours 820oclock,include 8 oif(TimeQueuen.CNumdata,Infor);next=NULL;TimeQueuen.first=Rem;TimeQueuen.last=Rem
3、;TimeQueuen.CNum+;成功预定nelse p=TimeQueuen.last;locat=TimeQueuen.CNum+1;p-next=Rem;没有空余机位!错误.请再次输入.nvoid waiting() 请输入想要排队的时间nif(TimeQueuen.CNum=MAX) if(TimeQueuen.CNum)=MAX) locat=0;TimeQueuen.middle=Rem;成功排队n有空余机位,无须等待n错误.再次输入.n取消模块 void cancel() struct node *q;请输入预定的时间nPlease input your No.!q=Rem;f
4、or(i=1;q=Rem,Rem=Rem-next,i+) if(inext=NULL) q-TimeQueuen.last=q;free(Rem);TimeQueuen.CNum-;Succeed to out the queue!next=Rem-next;TimeQueuen.middle-locat=Rem-locat;TimeQueuen.middle=TimeQueuen.middle-if(i=1) TimeQueuen.first=Rem-else q-成功取消预定!附录源代码:#includestdlib.hstring.h#define LENGTH 6 #define M
5、AX 20 #define S(r) (r-8)/2 #define NULL 0 struct node int locat;char data10;struct node *next;struct node *head;struct cell int CNum;struct node *first;struct node *middle;struct node *last;TimeQueueLENGTH;void booking() void inquir_waiting() 查询其他等待者的预定时间n等待列表 are:q=TimeQueuen.middle;q=q-next) printf(%sn,q-data);,TimeQueuen.last-这个时间段没有预定者n错误。请再次输入.n1. 查询预定的机位 2.查询空机位 3.预定 4. 取消预定 5.等待列表 6.查询等待者时间列表 0.退出n
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1