#include "stdafx.h"
#include
#include
#include
#define max 5
#define pri 5
typedef struct time{
int year;
int day;
int month;
int hour;
int min;
}Time;
typedef struct node{
char num[10];
Time reach;
Time leave;
}Carinfo;
typedef struct car{
Carinfo *data;
struct car *next;
}queue;
typedef struct Node{
queue *lead;
queue *end;
}link;
typedef struct NODE{
Carinfo *b[max+1];
int top;
}Zhan;
void Zhaninit(Zhan *s){
int i;
s->top=0;
for(i=0;i<=max;i++)
s->b[s->top]=NULL;
}
int queueinit(link *U){
U->lead=(queue *)malloc(sizeof(queue));
if(U->lead!=NULL)
{
U->lead->next=NULL;
U->end=U->end;
return(1);
}
else return(-1);
}
int Arrival(Zhan *into,link *R){
Carinfo *p;
queue *t;
p=(Carinfo *)malloc(sizeof(Carinfo));
flushall();
printf("\n車牌號:");
gets(p->num);
if(into->top<max)
{
into->top++;
printf("\n\n車輛在第%d位置.",into->top);
printf("\n到達
最佳回答:
代碼粘貼有錯誤:
if((R->lead!=R->end)&&into->top {
q=R->lead->next;