数据结构,C语言,车辆管理系统
#include<stdio.h>
#include<malloc.h>
#include<stdlib.h>
#include<conio.h>
#define OVERFLOW -2
#define OK 1
#define ERROR 0
#define STACK_INIT_SIZE 1
typedef int status ;
typedef struct{
int car_num;
int time;
}car_info;
typedef struct{
car_info *base;
car_info *top;
status stacksize;
}sqstack;
void Initstack(sqstack *s)
{
s->base=(car_info *)malloc(STACK_INIT_SIZE*sizeof(car_info));
if(!s->base) exit(OVERFLOW);
s->top=s->base;
s->stacksize=0;
}
void push(sqstack *s,car_info e)
{
*s->top++=e;
s->stacksize++;
}
car_info pop(sqstack *s)
{car_info e;
if(s->top==s->base){
printf("停车场内没有该车辆!\n");
exit(0) ;
}
e=*--s->top;
s->stacksize--;
return e;
}
typedef struct Qnode
{
int car_num;
int time;
struct Qnod