数据结构停车场管理系统c语言,数据结构C语言版课程设计停车场管理系统.pdf
课程设计 停车场:c 语言版本的数据结构课程设计,要求用栈模拟停车场,用队列模拟便道,实现停车场的收费管理系统停车场停满车后车会停在便道上面下面附上源码,vc:(下编译#include//#include//malloc#include//获取系统时间所用函数#include...
课程设计 停车场
:
c 语言版本的数据结构课程设计,要求用栈模拟停车场,用队
列模拟便道,实现停车场的收费管理系统
停车场停满车后车会停在便道上面
下面附上源码,vc:(下编译
#include
//#include //malloc
#include //获取系统时间所用函数
#include //getch()
#include //设置光标信息 mallco
#defineMaxSize 5 /*定义停车场栈长度*/
#definePRICE 0.05 /*每车每分钟收费值*/
#defineBASEPRICE 0.5 //基础停车费
#defineEsc27 //退出系统
#defineExit 3 //结束对话
#define Stop 1 //停车
#defineDrive2 //取车
intjx 0,jy 32; //全局变量日志打印位置
typedef struct
{inthour;
intminute;
}Time,*PTime; /*时间结点*/
typedef struct /*定义栈元素的类型即车辆信息结点*/
{intnum ; /*车牌号*/
Timearrtime; /*到达时刻或离区时刻*/
}CarNode;
typedef struct /*定义栈,模拟停车场*/
{CarNode stack[MaxSize];
inttop;
}SqStackCar;
typedef structnode /*定义队列结点的类型*/
{intnum; /*车牌号*/
structnode *next;
}QueueNode;
typedef struct /*定义队列,模拟便道*/
{QueueNode *front,*rear;
}LinkQueueCar;
/*函数声明*/
PTimeget_time();
CarNodegetcarInfo();
voidqingping(int a);
voidgotoxy(int x,inty);
voidprintlog(Timet,intn,int io,char ab,intpo,doublef);
voidprintstop(int a,intnum,intx0,inty0);
voidprintleave(int a,intpo,intnum);
/*初始化栈*/
voidInitSeqStack(SqStackCar *s)
{
s->top -1;
}
/*push 入站函数 */
intpush(SqStackCar *s,CarNodex) //数据元素x 入指针s所指的栈
{
if(s->top MaxSize-1)
return(0); //如果栈满,返回0
else
{
s->stack[++s->top] x; //栈不满,到达车辆入栈
return(1);
}
}
/*栈顶元素出栈*/
CarNodepop(SqStackCar *s)
{
CarNodex;

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐
所有评论(0)