C语言课程设计报告机房机位预约模拟系统方案Word文件下载.docx

上传人:b****4 文档编号:17835972 上传时间:2022-12-11 格式:DOCX 页数:19 大小:80.64KB
下载 相关 举报
C语言课程设计报告机房机位预约模拟系统方案Word文件下载.docx_第1页
第1页 / 共19页
C语言课程设计报告机房机位预约模拟系统方案Word文件下载.docx_第2页
第2页 / 共19页
C语言课程设计报告机房机位预约模拟系统方案Word文件下载.docx_第3页
第3页 / 共19页
C语言课程设计报告机房机位预约模拟系统方案Word文件下载.docx_第4页
第4页 / 共19页
C语言课程设计报告机房机位预约模拟系统方案Word文件下载.docx_第5页
第5页 / 共19页
点击查看更多>>
下载资源
资源描述

C语言课程设计报告机房机位预约模拟系统方案Word文件下载.docx

《C语言课程设计报告机房机位预约模拟系统方案Word文件下载.docx》由会员分享,可在线阅读,更多相关《C语言课程设计报告机房机位预约模拟系统方案Word文件下载.docx(19页珍藏版)》请在冰豆网上搜索。

C语言课程设计报告机房机位预约模拟系统方案Word文件下载.docx

2,即为预定,根据输入的日期和时间段查询是否有空机位,若有则预约,若无则提供最近空机时间段。

另:

若用户要求在非空时间上机,则将用户信息插入该时间段的等待列表.

3,退出预定,根据输入的时间,撤销该时间的预定。

4,查询是否有等待的信息,若有则按顺序显示联系方式,若无则显示提示信息。

2需求分析

根据题目要求在程序中需实现查询,预定,排队等功能的操作,所以需要建立相应的模块来实现;

另外还需提供键盘式选择菜单实现功能,在运行时达到所要目的。

3总体设计

整个系统可分为3个模块查询模块预定模块取消模块

详细设计

主函数比较简洁,只提供输入、功能处理和输出部分的函数调用。

main()

{

inti;

for(i=0;

i<

LENGTH;

i++){

TimeQueue[i].CNum=0;

TimeQueue[i].first=NULL;

TimeQueue[i].middle=NULL;

TimeQueue[i].last=NULL;

}

while

(1){

printf("

请输入序号!

:

\n"

);

1.查询预定的机位2.查询空机位3.预定4.取消预定5.等待列表6.查询等待者列表0.退出\n"

scanf("

%d"

&

i);

switch(i)

case1:

Inquir();

break;

case2:

inquir();

case3:

booking();

case4:

cancel();

case5:

waiting();

case6:

inquir_waiting();

case0:

exit(0);

default:

error\n"

}

voidInquir()

intn;

charInfor[10];

structnode*Rem;

输入查询时间(24hours8~20o'

clock,include8o'

clock)\n"

n);

if(n>

=8&

&

n<

20){

n=S(n);

请输入学号\n"

%s"

Infor);

Rem=TimeQueue[n].first;

for(;

Rem->

next!

=NULL;

Rem=Rem->

next)

if(strcmp(Rem->

data,Infor)==0)break;

if(Rem->

locat!

=0)

Thecomputernumberis%d\n"

Rem->

locat);

elseprintf("

对不起.你依旧在等待列表中或者没有预定"

错误,请再次输入.\n"

voidinquir()

输入想要查询的时间(24hours8~20o'

clock,include8o'

if(TimeQueue[n].CNum<

MAX)

Thereare%demptycomputer!

MAX-TimeQueue[n].CNum);

对不起.没有空余机位\n"

错误,再次输入.\n"

预定模块

voidbooking()

structnode*p;

输入想要预定的时间\n"

MAX){

请输入你的学号\n"

if(TimeQueue[n].first==NULL){

Rem=(structnode*)malloc(sizeof(structnode));

locat=1;

strcpy(Rem->

data,Infor);

next=NULL;

TimeQueue[n].first=Rem;

TimeQueue[n].last=Rem;

TimeQueue[n].CNum++;

成功预定\n"

else{

p=TimeQueue[n].last;

locat=TimeQueue[n].CNum+1;

p->

next=Rem;

没有空余机位!

"

错误.请再次输入.\n"

voidwaiting()

请输入想要排队的时间\n"

if(TimeQueue[n].CNum>

=MAX){

if((TimeQueue[n].CNum)==MAX){

locat=0;

TimeQueue[n].middle=Rem;

成功排队\n"

有空余机位,无须等待\n"

错误.再次输入.\n"

取消模块

voidcancel()

structnode*q;

请输入预定的时间\n"

PleaseinputyourNo.!

q=Rem;

for(i=1;

;

q=Rem,Rem=Rem->

next,i++)

if(i>

next==NULL){

q->

TimeQueue[n].last=q;

free(Rem);

TimeQueue[n].CNum--;

Succeedtooutthequeue!

next=Rem->

next;

TimeQueue[n].middle->

locat=Rem->

locat;

TimeQueue[n].middle=TimeQueue[n].middle->

if(i==1)TimeQueue[n].first=Rem->

elseq->

成功取消预定!

附录源代码:

#include<

stdio.h>

stdlib.h>

string.h>

#defineLENGTH6

#defineMAX20

#defineS(r)(r-8)/2

#defineNULL0

structnode{

intlocat;

chardata[10];

structnode*next;

};

structnode*head;

structcell{

intCNum;

structnode*first;

structnode*middle;

structnode*last;

}TimeQueue[LENGTH];

voidbooking()

voidinquir_waiting()

查询其他等待者的预定时间\n"

等待列表are:

q=TimeQueue[n].middle;

q=q->

next)printf("

%s\n"

q->

data);

TimeQueue[n].last->

这个时间段没有预定者\n"

错误。

请再次输入.\n"

1.查询预定的机位2.查询空机位3.预定4.取消预定5.等待列表6.查询等待者时间列表0.退出\n"

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

当前位置:首页 > 求职职场 > 简历

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1