2022年数据结构c语言版课程设计报告停车场管理系统 .pdf
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《2022年数据结构c语言版课程设计报告停车场管理系统 .pdf》由会员分享,可在线阅读,更多相关《2022年数据结构c语言版课程设计报告停车场管理系统 .pdf(20页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、. word 专业资料课程设计 :停车场c 语言版本的数据结构课程设计,要求用栈模拟停车场,用队列模拟便道 ,实现停车场的收费管理系统名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 20 页 - - - - - - - - - . word 专业资料停车场停满车后车会停在便道上面下面附上源码 ,vc:(下编译#include /#include /malloc #include / 获取系统时间所用函数#include /getch() #include / 设置光标信息
2、mallco 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 20 页 - - - - - - - - - . word 专业资料#define MaxSize 5 /* 定义停车场栈长度*/ #define PRICE 0.05 /* 每车每分钟收费值*/ #define BASEPRICE 0.5 / 基础停车费#define Esc 27 / 退出系统#define Exit 3 / 结束对话#define Stop 1 / 停车#define Drive 2 /
3、取车int jx=0,jy=32; / 全局变量日志打印位置typedef struct int hour; int minute; Time,*PTime; /* 时间结点 */ typedef struct /* 定义栈元素的类型即车辆信息结点*/ int num ; /* 车牌号 */ Time arrtime; /* 到达时刻或离区时刻*/ CarNode; typedef struct /* 定义栈 ,模拟停车场 */ CarNode stackMaxSize; int top; SqStackCar; typedef struct node /* 定义队列结点的类型*/ int n
4、um; /* 车牌号 */ struct node *next; QueueNode; typedef struct /* 定义队列 ,模拟便道 */ QueueNode *front,*rear; LinkQueueCar; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 20 页 - - - - - - - - - . word 专业资料/* 函数声明 */ PTime get_time(); CarNode getcarInfo(); void qingping(i
5、nt a); void gotoxy(int x,int y); void printlog(Time t,int n,int io,char ab,int po,double f); void printstop(int a,int num,int x0,int y0); void printleave(int a,int po,int num); /* 初始化栈 */ void InitSeqStack(SqStackCar *s) s-top=-1; /* push入站函数*/ int push(SqStackCar *s,CarNode x) / 数据元素x 入指针 s 所指的栈 if
6、(s-top=MaxSize-1) return(0); / 如果栈满 ,返回 0 else s-stack+s-top=x; / 栈不满 ,到达车辆入栈return(1); /* 栈顶元素出栈 */ CarNode pop(SqStackCar *s) CarNode x; if(s-toptop-; return(s-stacks-top+1); / 栈不空 ,返回栈顶元素 /* 初始化队列 */ void InitLinkQueue(LinkQueueCar *q) q-front=(QueueNode*)malloc(sizeof(QueueNode); / 产生一个新结点,作头结点i
7、f(q-front!=NULL) q-rear=q-front; q-front-next=NULL; q-front-num=0; / 头结点的num保存队列中数据元素的个数 /* 数据入队列 */ void EnLinkQueue(LinkQueueCar *q,int x) QueueNode *p; p=(QueueNode*)malloc(sizeof(QueueNode); / 产生一个新结点p-num=x; p-next=NULL; q-rear-next=p; / 新结点入队列q-rear=p; q-front-num+; / 队列元素个数加1 /* 数据出队列 */ int
8、DeLinkQueue(LinkQueueCar *q) QueueNode *p; int n; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 20 页 - - - - - - - - - . word 专业资料if(q-front=q-rear) / 队空返回0 return(0); else p=q-front-next; q-front-next=p-next; if(p-next=NULL) q-rear=q-front; n=p-num; free(p);
9、q-front-num-; return(n); / 返回出队的数据信息 /* 车辆到达*/ / 参数:停车栈停车队列车辆信息/ 返回值:空/ 功能:对传入的车辆进行入栈栈满则入队列void Arrive(SqStackCar *stop,LinkQueueCar *lq,CarNode x) int f; f=push(stop,x); / 入栈if (f=0) / 栈满 EnLinkQueue(lq,x.num); / 入队printstop(1,lq-front-num,0,23); printlog(x.arrtime,x.num,1,B,lq-front-num,0); qingpi
10、ng(0); printf(您的车停在便道%d 号车位上 n,lq-front-num); / 更新对话 else printstop(0,stop-top+1,0,23); printlog(x.arrtime,x.num,1,P,stop-top+1,0); qingping(0); printf(您的车停在停车场%d 号车位上 n,stop-top+1); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 20 页 - - - - - - - - - . word 专
11、业资料/ 更新对话 qingping(1); printf(按任意键继续); getch(); /* 车辆离开*/ / 参数:停车栈指针s1,暂存栈指针s2,停车队列指针p,车辆信息x / 返回值:空/ 功能:查找栈中s1 的 x 并出栈,栈中没有则查找队p 中并出队,打印离开收费信息void Leave(SqStackCar *s1,SqStackCar *s2,LinkQueueCar *p,CarNode x) double fee=0; int position=s1-top+1; / 车辆所在车位int n,f=0; CarNode y; QueueNode *q; while(s1
12、-top -1)&(f!=1) / 当栈不空且未找到x y=pop(s1); if(y.num!=x.num) n=push(s2,y); position-; else f=1; if(y.num=x.num) / 找到 x gotoxy(33,17);printf(%d:%-2d,(x.arrtime.hour-y.arrtime.hour),(x.arrtime.minute-y.arrtime.minute) ); fee=(x.arrtime.hour-y.arrtime.hour)*60+(x.arrtime.minute-y.arrtime.minute)*PRI名师资料总结 -
13、 - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 7 页,共 20 页 - - - - - - - - - . word 专业资料CE+BASEPRICE; gotoxy(48,17); printf(%2.1f元n,fee); qingping(0); printf(确认您的车辆信息); qingping(1); printf(按任意键继续); getch(); while(s2-top-1) y=pop(s2); f=push(s1,y); n=DeLinkQueue(p); if(n!=0) y
14、.num=n; y.arrtime=x.arrtime; f=push(s1,y); printleave(p-front-num+1,position,s1-top+1); / 出栈动画ji 队列成员入栈printlog(x.arrtime,x.num,0,P,position,fee); printlog(y.arrtime,y.num,1,P,s1-top+1,0); else printleave(0,position,s1-top+2); printlog(x.arrtime,x.num,0,P,position,fee); else / 若栈中无x while(s2-top -1)
15、 / 还原栈 y=pop(s2); f=push(s1,y); q=p-front; f=0; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 8 页,共 20 页 - - - - - - - - - . word 专业资料position=1; while(f=0&q-next!=NULL) / 当队不空且未找到x if(q-next-num!=x.num) q=q-next; position+; else / 找到 x q-next=q-next-next; p-front-n
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年数据结构c语言版课程设计报告停车场管理系统 2022 数据结构 语言版 课程设计 报告 停车场 管理 系统
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内