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

开通VIP
 

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

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

开通VIP折扣优惠下载文档

            查看会员权益                  [ 下载后找不到文档?]

填表反馈(24小时):  下载求助     关注领币    退款申请

开具发票请登录PC端进行申请

   平台协调中心        【在线客服】        免费申请共赢上传

权利声明

1、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
2、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,个别因单元格分列造成显示页码不一将协商解决,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
3、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
4、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前可先查看【教您几个在下载文档中可以更好的避免被坑】。
5、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
6、文档遇到问题,请及时联系平台进行协调解决,联系【微信客服】、【QQ客服】,若有其他问题请点击或扫码反馈【服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【版权申诉】”,意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:0574-28810668;投诉电话:18658249818。

注意事项

本文(数据结构项目课程报告停车场管理系统.doc)为本站上传会员【精***】主动上传,咨信网仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知咨信网(发送邮件至1219186828@qq.com、拔打电话4009-655-100或【 微信客服】、【 QQ客服】),核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载【60天内】不扣币。 服务填表

数据结构项目课程报告停车场管理系统.doc

1、 安阳师范学院 ·数据结构项目课程· 数据结构项目课程报告 一、 问题描述及分析 题目要求: 设停车场内只有一个可停放n辆汽车的狭长通道,且只有一个大门可供汽车进出。汽车在停车场内按车辆到达时间的先后顺序,依次由北向南排列(大门在最南端,最先到达的第一辆车停放在车场的最北端),若车场内已停满n辆汽车,则后来的汽车只能在门外的便道上等候,一旦有车开走,则排在便道上的第一辆车即可开入;当停车场内某辆车要离开时,在它之后开入的车辆必须先退出车场为它让路,待该车辆开出大门外,其他

2、车辆再按原次序进入车场,每辆车停放在车场的车在它离开停车场时必须按它停留的时间长短交纳费用。试为停车场编制按上述要求进行管理的模拟程序。 分析: 由题目只有一个大门进出并且“先到后处理”可知,应使构造栈模拟停车场,进入离开停车场即入栈出栈的过程;而便道等候的汽车符合“先到先处理”原则 ,应构造线性队列模拟;构造存储结构,存放车辆信息,车牌号,到达离开时间;通过time.h头文件中的函数获取汽车到来以及离开时间,利用时间差计算价钱。 主要模块如下图: 停车场管理系统 车辆到达停车场 车辆进入停车场 车辆离开停车场 车辆停留在便道 车辆进入停车场 输出车辆的进入信息 记录进入

3、的时间位置 输出车辆的离开信息 记录车辆离开的时间位置 输出应缴纳的费用 便道的车辆进入停车场 二、 功能模块及数据结构描述 头文件、宏定义以及存储结构 结构体定义相关类型的链表空间有顺序栈的定义、链队、车辆信息结构体、时间计算结构体、车辆位置字符型结构体数组和循环单链表存储下一个地址空间。 #include #include #include #include #include #define OK 1 #define ERROR 0 typ

4、edef struct time1 { char times[100]; long time2; }time1; typedef struct node { char num[10]; time1 reach; time1 leave; }Car; typedef struct Stack { Car *stack[100]; int top; }SqStack; typedef struct car { Car *data; struct car *next; }QNode; typedef struct Node

5、 { QNode *front; QNode *rear; }LinkQueue; 主函数 void main() { SqStack In, Out; LinkQueue Wait; int ch; int MAX; float price; printf("请输入停车场的容量:"); scanf("%d", &MAX); printf("请输入停车场的收费标准(元 / 小时) :"); scanf("%f", &price); InitStack(&In, MAX); InitStack(&Out, MAX); InitQ

6、ueue(&Wait); while (1) { system("color 0A"); printf(" == == == = 欢迎使用停车场管理系统 == == == == == == == == == == \n"); printf("输入的停车场容量为%d位,费用为%2.1f元 / 小时, 请按任意键进入系统", MAX, price); getchar(); system("CLS"); printf(" == == == = 欢迎使用停车场管理系统 == == == == == == == == == \n"); printf(

7、"您输入的停车场容量为%d位,费用为%2.1f元 / 小时。\n", MAX, price); printf("\n == == == == == == == == == == == == = \n"); printf("(1)车辆到达\n(2)车辆离开\n(3)停车场信息\n(4)退出系统\n请选择\n"); printf("\n == == == == == == == == == == == == == = \n"); while (1) { printf("请输入操作的序号"); scanf("%d", &ch); switch

8、 (ch) { case 1: arrive(&In, &Wait, MAX, price); break; case 2: leave(&In, &Out, &Wait, MAX, price); break; case 3: info(In, Wait); break; case 4: { system("CLS"); printf("\n == == == == == == == == == == == == == == \n");

9、printf(" 谢谢使用!\n"); printf("\n == == == == == == == == == == == == == == == == == == == == = \n"); exit(0); } default:printf("\n按键无效,请重新按键选择"); getchar(); } system("CLS"); printf(" == == == == == 欢迎使用停车场管理系统 ==

10、 == == = \n"); printf("您输入的停车场容量为%d位,费用为%2.1f元 / 小时。\n", MAX, price); printf("\n == == == == == == == == == == == == == == == == == == == == \n"); printf("(1)车辆到达\n(2)车辆离开\n(3)停车场信息\n(4)退出系统\n请选择\n"); printf("\n == == == == == == == == == == == == == == == == == == == == == \n");

11、 } } } 费用计算函数,通过时间差计算费用 void print(Car *p, int room, int MAX, float price) { time_t rawtime; struct tm * timeinfo; long A1, A2, B1, B2; time ( &rawtime ); timeinfo = localtime ( &rawtime ); p->leave.time2=rawtime; printf("\n车离开的时间为:%s ",asctime (timeinfo)); strcpy(p->lea

12、ve.times,asctime (timeinfo)); printf("\n车牌号码:"); puts(p->num); printf("\n车到达的时间是: %s ", p->reach.times); printf("\n车离开的时间是: %s ", p->leave.times); A1=p->leave.time2; A2=p->reach.time2; B1=p->leave.time2-p->reach.time2; if(B1<=3600&&B1>=0) printf("\n费用为: %2.1f元", price); else

13、 printf("\n费用为: %2.1f元", B1/3600*price); free(p); }//消费计算函数 车辆到达函数,获取车辆信息,判断是否有车位,进行入栈或入队操作 int arrive(SqStack *In, LinkQueue *W, int MAX, float price) { Car *p; QNode *t; time_t rawtime; struct tm * timeinfo; //time ( &rawtime ); // 获取时间,以秒计,从1970年1月一日起算,存于rawtime //timeinfo =

14、 localtime ( &rawtime ); //转为当地时间,tm 时间结构 //printf ( "当前系统时间: %s", asctime (timeinfo) ); //asctime (timeinfo); // 转为标准ASCII时间格式: p = (Car *)malloc(sizeof(Car)); printf(" == == == == == == == == == == = 欢迎使用停车场管理系统 == == == == == == == == == == = \n"); printf("您输入的停车场容量为%d位,费用为%2.1f元 / 小时

15、\n", MAX, price); printf("停车场还有%d停车位, 车可先进入便道等待", MAX - In->top); printf("\n请输入车牌号码(例:警A1035) :"); getchar(); scanf("%s", p->num); getchar(); if (In->top < MAX) { time ( &rawtime ); p->reach.time2=rawtime; timeinfo = localtime ( &rawtime ); In->top++; printf("停车的位置:%d号停

16、车位。", In->top); printf("\n车到达的时间为%s: ",asctime (timeinfo)); strcpy(p->reach.times,asctime (timeinfo)); In->stack[In->top] = p; printf("请按任意键返回\n"); printf("\n == == == == == == == == == == == == == == == == == == == == == == == \n"); getchar(); return OK; } else { pri

17、ntf(" == == == == = 欢迎使用停车场管理系统 == == == == == == == == = \n"); printf("您输入的停车场容量为%d位,费用为%2.1f元 / 小时。\n", MAX, price); printf("\n == == == == == == == == == == == == == == == == == == == == = \n"); printf("停车位已满,该车须在便道等待!"); t = (QNode *)malloc(sizeof(QNode)); t->data = p; t->next

18、 NULL; W->rear->next = t; W->rear = t; printf("\n请按任意键返回"); getchar(); return OK; } getchar(); } 车辆离开函数,如果是最前面的车离开,后面的车必须都进行出栈操作进入到另一个栈中让需要离开的车离开后再重新进入;如果便道有车那么便道的前面的车即先入队的车进行出队入栈 void leave(SqStack *In, SqStack *Out, LinkQueue *W, int MAX, float price) { int place; Car

19、 *p, *t; QNode *q; time_t rawtime; struct tm * timeinfo; system("CLS"); if (In->top>0) { while (1) { printf(" == == == == 欢迎使用停车场管理系统 == == == == == == == == == \n"); printf("您输入的停车场容量为%d位,费用为%2.1f元 / 小时。\n", MAX, price); printf("\n == == == == == == == == == == == ==

20、 == == == == == == == == == == == == = \n"); printf("请输入车在停车场的位置(1 - %d):", In->top); scanf("%d", &place); if (place >= 1 && place <= In->top) break; } while (In->top>place) { Out->top++; Out->stack[Out->top] = In->stack[In->top]; In->stack[In->top] = NULL; In-

21、>top--; } p = In->stack[In->top]; In->stack[In->top] = NULL; In->top--; while (Out->top >= 1) { In->top++; In->stack[In->top] = Out->stack[Out->top]; Out->stack[Out->top] = NULL; Out->top--; } print(p, place, MAX, price); if ((W->front != W->rear) && In->to

22、pfront->next; t = q->data; In->top++; printf("\n便道的%s号车进入车场第%d号停车位。", t->num, In->top); printf("\n车到达的时间: %s ",asctime (timeinfo)); t->reach.time2=rawtime; strcpy(t->reach.times,asctime (ti

23、meinfo)); W->front->next = q->next; if (q == W->rear) W->rear = W->front; In->stack[In->top] = t; free(q); } } else printf("\n == == == == == == == == == == == == == == == == == == == == == == == == = \n"); printf("停车场里没有车\n"); printf("\n请按任意键返回"); printf("\n\n ==

24、 == == == == == == == == == == == == == == == == == == == == == == == = \n"); getchar(); getchar(); } 停车场信息函数,遍历队列和栈能知道便道中和停车场中车辆信息 void info1(SqStack *S) { int i; if (S->top>0) { printf("\n 停车场\n"); for (i = 1; i <= S->top; i++) { printf("\n 位置: \n

25、 %d\n", i); printf(" 到达时间:\n%s 车牌号: \n %s\n", S->stack[i]->reach.times,S->stack[i]->num); } } else { printf("\n == == == == == == == == == == == == == == == == == == == == = \n"); printf("停车场里没有车"); } } void info2(LinkQueue *W) { QNode *p; p = W->fr

26、ont->next; if (W->front != W->rear) { printf("\n便道中车辆的号码为:\n"); while (p != NULL) { printf("%s\n", p->data->num); p = p->next; } } else printf("\n便道里没有车\n"); printf("\n请按任意键返回\n"); printf("\n\n == == == == == == == == == == == == == == == == == == == == == \n");

27、 getchar(); } void info(SqStack S, LinkQueue W) { system("CLS"); info1(&S); info2(&W); getchar(); } 队列和栈的初始化 void InitStack(SqStack *s, int MAX) { int i; s->top = 0; for (i = 0; i <= MAX; i++) s->stack[s->top] = NULL; } int InitQueue(LinkQueue *Q) { Q->front = (QNode

28、 *)malloc(sizeof(QNode)); if (Q->front != NULL) { Q->front->next = NULL; Q->rear = Q->front; return OK; } else return ERROR; }//队列和栈初始函数 三、 主要算法流程描述及部分核心算法 流程描述 1.车辆到达停车场 其中车辆到达时需要用户输入车辆信息,接着要判断栈是否已满,如当前栈未满,则进行入栈操作,即车辆进入停车场;如果栈已满,则车辆必须进入便道等待。 2. 车辆进入停车场 车辆进入,则进行入栈操作,即将车辆信息结

29、点进行入栈操作。 3. 车辆离开停车场 车辆的离开,则需要另设一个栈,给离去的汽车让路而从停车场退出来的汽车临时停放,也用顺序栈实现,车辆离开后需检查便道内是否有车辆等待,若有等待车辆则进行便道内的车辆进入停车场的操作,即将车辆信息结点进行入栈操作,输入当前时间后开始计费,最后进行出队操作,表示车辆已离开便道。 核心算法 车辆到达停车场 获取车辆到达时间 是 车辆进入停车场 开 始 记录车辆信息和到达时间 判断是否重复有车辆 否 是 储存车辆信息和时间信息 结 束 车辆离开停车场 开 始 获取车辆离

30、开信息和时间 计算时间差运算停车费用 判断便道中是否有车 否 输出离开停车场信息和收费金额 车辆离开停车场更新栈表 结 束 是 输出车辆现在停止在便道位置 等待车辆离开 四、 系统使用说明 运行环境为VC++6.0,如果需要在VS上运行需要改动scanf函数为scanf_s 运行截图 附:源码 #include #include #include #include #include #defin

31、e OK 1 #define ERROR 0 typedef struct time1 { char times[100]; long time2; }time1; typedef struct node { char num[10]; time1 reach; time1 leave; }Car; typedef struct Stack { Car *stack[100]; int top; }SqStack; typedef struct car { Car *data; struct car *next; }

32、QNode; typedef struct Node { QNode *front; QNode *rear; }LinkQueue; 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

33、 info2(LinkQueue *W); void info(SqStack S, LinkQueue W); void InitStack(SqStack *s, int MAX); int InitQueue(LinkQueue *Q); void main() { SqStack In, Out; LinkQueue Wait; int ch; int MAX; float price; printf("请输入停车场的容量:"); scanf("%d", &MAX); printf("请输入停车场的收费标准(元 / 小时) :");

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

35、 printf(" == == == = 欢迎使用停车场管理系统 == == == == == == == == == \n"); printf("您输入的停车场容量为%d位,费用为%2.1f元 / 小时。\n", MAX, price); printf("\n == == == == == == == == == == == == = \n"); printf("(1)车辆到达\n(2)车辆离开\n(3)停车场信息\n(4)退出系统\n请选择\n"); printf("\n == == == == == == == == == == == == == = \n");

36、 while (1) { printf("请输入操作的序号"); scanf("%d", &ch); switch (ch) { case 1: arrive(&In, &Wait, MAX, price); break; case 2: leave(&In, &Out, &Wait, MAX, price); break; case 3: info(In, Wait); break; case 4: { system("CLS");

37、 printf("\n == == == == == == == == == == == == == == \n"); printf(" 谢谢使用!\n"); printf("\n == == == == == == == == == == == == == == == == == == == == = \n"); exit(0); } default:printf("\n按键无效,请重新按键选择"); get

38、char(); } system("CLS"); printf(" == == == == == 欢迎使用停车场管理系统 == == == == = \n"); printf("您输入的停车场容量为%d位,费用为%2.1f元 / 小时。\n", MAX, price); printf("\n == == == == == == == == == == == == == == == == == == == == \n"); printf("(1)车辆到达\n(2)车辆离开\n(3)停车场信息\n(4)退出系统\n请选择\n"); print

39、f("\n == == == == == == == == == == == == == == == == == == == == == \n"); } } } //主函数菜单 void print(Car *p, int room, int MAX, float price) { time_t rawtime; struct tm * timeinfo; long A1, A2, B1, B2; time ( &rawtime ); timeinfo = localtime ( &rawtime ); p->leave.time2=rawtime

40、 printf("\n车离开的时间为:%s ",asctime (timeinfo)); strcpy(p->leave.times,asctime (timeinfo)); printf("\n车牌号码:"); puts(p->num); printf("\n车到达的时间是: %s ", p->reach.times); printf("\n车离开的时间是: %s ", p->leave.times); A1=p->leave.time2; A2=p->reach.time2; B1=p->leave.time2-p->reach.time2;

41、 if(B1<=3600&&B1>=0) printf("\n费用为: %2.1f元", price); else printf("\n费用为: %2.1f元", B1/3600*price); free(p); }//消费计算函数 int arrive(SqStack *In, LinkQueue *W, int MAX, float price) { Car *p; QNode *t; time_t rawtime; struct tm * timeinfo; //time ( &rawtime ); // 获取时间,以秒计,从19

42、70年1月一日起算,存于rawtime //timeinfo = localtime ( &rawtime ); //转为当地时间,tm 时间结构 //printf ( "当前系统时间: %s", asctime (timeinfo) ); //asctime (timeinfo); // 转为标准ASCII时间格式: p = (Car *)malloc(sizeof(Car)); printf(" == == == == == == == == == == = 欢迎使用停车场管理系统 == == == == == == == == == == = \n"); print

43、f("您输入的停车场容量为%d位,费用为%2.1f元 / 小时。\n", MAX, price); printf("停车场还有%d停车位, 车可先进入便道等待", MAX - In->top); printf("\n请输入车牌号码(例:警A1035) :"); getchar(); scanf("%s", p->num); getchar(); if (In->top < MAX) { time ( &rawtime ); p->reach.time2=rawtime; timeinfo = localtime ( &rawtime ); I

44、n->top++; printf("停车的位置:%d号停车位。", In->top); printf("\n车到达的时间为%s ",asctime (timeinfo)); strcpy(p->reach.times,asctime (timeinfo)); In->stack[In->top] = p; printf("请按任意键返回\n"); printf("\n == == == == == == == == == == == == == == == == == == == == == == == \n"); getchar(); ret

45、urn OK; } else { printf(" == == == == = 欢迎使用停车场管理系统 == == == == == == == == = \n"); printf("您输入的停车场容量为%d位,费用为%2.1f元 / 小时。\n", MAX, price); printf("\n == == == == == == == == == == == == == == == == == == == == = \n"); printf("停车位已满,该车须在便道等待!"); t = (QNode *)malloc(sizeof(QNode))

46、 t->data = p; t->next = NULL; W->rear->next = t; W->rear = t; printf("\n请按任意键返回"); getchar(); return OK; } getchar(); } void leave(SqStack *In, SqStack *Out, LinkQueue *W, int MAX, float price) { int place; Car *p, *t; QNode *q; time_t rawtime; struct tm * ti

47、meinfo; system("CLS"); if (In->top>0) { while (1) { printf(" == == == == 欢迎使用停车场管理系统 == == == == == == == == == \n"); printf("您输入的停车场容量为%d位,费用为%2.1f元 / 小时。\n", MAX, price); printf("\n == == == == == == == == == == == == == == == == == == == == == == == == == = \n"); prin

48、tf("请输入车在停车场的位置(1 - %d):", In->top); scanf("%d", &place); if (place >= 1 && place <= In->top) break; } while (In->top>place) { Out->top++; Out->stack[Out->top] = In->stack[In->top]; In->stack[In->top] = NULL; In->top--; } p = In->stack[In->top]; In->stack[In

49、>top] = NULL; In->top--; while (Out->top >= 1) { In->top++; In->stack[In->top] = Out->stack[Out->top]; Out->stack[Out->top] = NULL; Out->top--; } print(p, place, MAX, price); if ((W->front != W->rear) && In->top

50、time ( &rawtime ); q = W->front->next; t = q->data; In->top++; printf("\n便道的%s号车进入车场第%d号停车位。", t->num, In->top); printf("\n车到达的时间: %s ",asctime (timeinfo)); t->reach.time2=rawtime; strcpy(t->reach.times,asctime (timeinfo)); W->front->next = q->next; if (q ==

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服