ImageVerifierCode 换一换
格式:DOCX , 页数:28 ,大小:394.09KB ,
资源ID:17608480      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/17608480.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(数据结构项目课程报告停车场管理系统Word格式.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

数据结构项目课程报告停车场管理系统Word格式.docx

1、Car;typedef struct Stack Car *stack100; int top;SqStack;typedef struct car Car *data; struct car *next;QNode;typedef struct Node QNode *front; QNode *rear;LinkQueue;主函数void main() SqStack In, Out; LinkQueue Wait; int ch; int MAX; float price; printf(请输入停车场的容量:); scanf(%d, &MAX);请输入停车场的收费标准(元 / 小时) :

2、%fprice); InitStack(&In, MAX);Out, MAX); InitQueue(&Wait); while (1) system(color 0A printf( = = = = 欢迎使用停车场管理系统 = = = = = = = = = = n输入的停车场容量为%d位,费用为%2.1f元 / 小时, 请按任意键进入系统, MAX, price); getchar();CLS = = = = 欢迎使用停车场管理系统 = = = = = = = = = n您输入的停车场容量为%d位,费用为%2.1f元 / 小时。nn = = = = = = = = = = = = = n(

3、1)车辆到达n(2)车辆离开n(3)停车场信息n(4)退出系统n请选择nn = = = = = = = = = = = = = = n while (1) printf(请输入操作的序号 scanf(ch); switch (ch) case 1: arrive(&In, &Wait, MAX, price); break; case 2: leave(&Out, & case 3: info(In, Wait); case 4: system( printf(n = = = = = = = = = = = = = = n printf( 谢谢使用!n = = = = = = = = = =

4、= = = = = = = = = = = n exit(0); default:printf(n按键无效,请重新按键选择 getchar(); system( = = = = = 欢迎使用停车场管理系统 = = = = = nn = = = = = = = = = = = = = = = = = = = = nn = = = = = = = = = = = = = = = = = = = = = n 费用计算函数,通过时间差计算费用void print(Car *p, int room, int MAX, float price) time_t rawtime; struct tm * ti

5、meinfo; long A1, A2, B1, B2; time ( &rawtime ); timeinfo = localtime ( & p-leave.time2=rawtime;n车离开的时间为:%s ,asctime (timeinfo); strcpy(p-leave.times,asctime (timeinfo);n车牌号码: puts(p-num);n车到达的时间是: %s , p-reach.times);n车离开的时间是:leave.times); A1=p-leave.time2; A2=p-reach.time2; B1=p-leave.time2-p- if(B

6、1=0)n费用为: %2.1f元, price); else, B1/3600*price); free(p);/消费计算函数车辆到达函数,获取车辆信息,判断是否有车位,进行入栈或入队操作int arrive(SqStack *In, LinkQueue *W, int MAX, float price) Car *p; QNode *t; /time ( & / 获取时间,以秒计,从1970年1月一日起算,存于rawtime /timeinfo = localtime ( & /转为当地时间,tm 时间结构 /printf ( 当前系统时间: %s, asctime (timeinfo) )

7、; /asctime (timeinfo); / 转为标准ASCII时间格式: p = (Car *)malloc(sizeof(Car); = = = = = = = = = = = 欢迎使用停车场管理系统 = = = = = = = = = = = n停车场还有%d停车位, 车可先进入便道等待, MAX - In-top);n请输入车牌号码(例:警A1035) : getchar();%s if (In-top reach.time2=rawtime; timeinfo = localtime ( & In-top+;停车的位置:%d号停车位。, In-n车到达的时间为%s: strcpy

8、(p-reach.times,asctime (timeinfo);stackIn-top = p;请按任意键返回nn = = = = = = = = = = = = = = = = = = = = = = = n return OK; = = = = = 欢迎使用停车场管理系统 = = = = = = = = = n停车位已满,该车须在便道等待! t = (QNode *)malloc(sizeof(QNode); t-data = p;next = NULL; W-rear-next = t;rear = t;n请按任意键返回车辆离开函数,如果是最前面的车离开,后面的车必须都进行出栈操作进

9、入到另一个栈中让需要离开的车离开后再重新进入;如果便道有车那么便道的前面的车即先入队的车进行出队入栈void leave(SqStack *In, SqStack *Out, LinkQueue *W, int MAX, float price) int place; Car *p, *t; QNode *q; system(top0) = = = = 欢迎使用停车场管理系统 = = = = = = = = = nn = = = = = = = = = = = = = = = = = = = = = = = = = = n请输入车在停车场的位置(1 - %d):place); if (plac

10、e = 1 & place top) break; while (In-place) Out-stackOut-top = In-top; In-top = NULL;top-; p = In- while (Out-top = 1)top = Out- print(p, place, MAX, price); if (W-front != W-rear) & In-topfront-next; t = q-data;n便道的%s号车进入车场第%d号停车位。, t-num, In- n车到达的时间: t- strcpy(t- W-next = q- if (q = W-rear) W-rear

11、 = W-front;top = t; free(q);n = = = = = = = = = = = = = = = = = = = = = = = = = n停车场里没有车nnn = = = = = = = = = = = = = = = = = = = = = = = = = = n停车场信息函数,遍历队列和栈能知道便道中和停车场中车辆信息void info1(SqStack *S) int i; if (S-n 停车场n for (i = 1; i top; i+)n 位置: n %dn, i); 到达时间:n%s 车牌号: n %sn, S-stacki-reach.times,S-

12、停车场里没有车void info2(LinkQueue *W) QNode *p; p = W- if (W-rear)n便道中车辆的号码为: while (p != NULL)%sndata- p = p- else printf(n便道里没有车nn请按任意键返回nnn = = = = = = = = = = = = = = = = = = = = = nvoid info(SqStack S, LinkQueue W) info1(&S); info2(&W);队列和栈的初始化void InitStack(SqStack *s, int MAX) s-top = 0; for (i = 0

13、;= MAX; s-stacks-int InitQueue(LinkQueue *Q) Q-front = (QNode *)malloc(sizeof(QNode); if (Q- Q-rear = Q- else return ERROR;/队列和栈初始函数三、 主要算法流程描述及部分核心算法流程描述1.车辆到达停车场其中车辆到达时需要用户输入车辆信息,接着要判断栈是否已满,如当前栈未满,则进行入栈操作,即车辆进入停车场;如果栈已满,则车辆必须进入便道等待。2. 车辆进入停车场车辆进入,则进行入栈操作,即将车辆信息结点进行入栈操作。3. 车辆离开停车场车辆的离开,则需要另设一个栈,给离去

14、的汽车让路而从停车场退出来的汽车临时停放,也用顺序栈实现,车辆离开后需检查便道内是否有车辆等待,若有等待车辆则进行便道内的车辆进入停车场的操作,即将车辆信息结点进行入栈操作,输入当前时间后开始计费,最后进行出队操作,表示车辆已离开便道。核心算法车辆到达停车场获取车辆到达时间是车辆进入停车场车辆离开停车场四、 系统使用说明运行环境为VC+6.0,如果需要在VS上运行需要改动scanf函数为scanf_s运行截图附:源码void print(Car *p, int room, int MAX, float price);int arrive(SqStack *In, LinkQueue *W, int MAX, float price);void leave(SqStack *In, SqStack *Out, LinkQueue *W, int MAX, float price);void info1(SqStack *S);void info2(LinkQueue *W);void info(SqStack S, LinkQueue W);void InitStack(SqStack *s, int MAX);int InitQueue(LinkQueue *Q);

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

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