用队列或栈实现一个简单停车场管理

来源:百度知道 编辑:UC知道 时间:2024/04/30 23:25:29
实现车辆的停入,开出操作,查询停车场信息看看是否有空位!!
源程序说明。六月2号之前给我 要不就不给分

如果有兴趣来电我公司
www.szdvl.com
0755-61520452

#define length 3
#define null 0
#define M length
#define PRICE 5
#ifdef M
typedef struct
{
char status;
int no;
int time;
}data;

typedef struct
{
data *base;
data *top;
int stacksize;
}stack;

void initstack (stack *s)
{
s->base=(data *)malloc(length*sizeof(data));
s->top=s->base;
s->stacksize=length;
}

void pushstack (stack *p)
{
int i=0;
printf("Please push stack data:\n");
while(i<p->stacksize)
{
scanf(" %c%d%d",&(p->top->status),&(p->top->no),&(p->top->time));
(p->top)++;
i++;
}
(--p->top);
}

void popstack (stack *p)
{
int i=p->stacksize;