用*标记的句子就是报错的地方,三次报错一样
main()
{struct car{
int inf;
int num;
int time;
struct car *next;
};
int m,n=0,j=0,time1;
int max=3;
struct car *p1,*p2;
struct car *front,*rear;
struct car *top1,*base1;
struct car *top2,*base2;
p1=(struct car*)malloc(sizeof(struct car));
top1=base1=(struct car*)malloc(3*sizeof(struct car));
top2=base2=(struct car*)malloc(sizeof(struct car));
front=rear=(struct car*)malloc(sizeof(struct car));
printf("input the information of this car:");
scanf("%d",&p1->inf);
printf("input the number of this car:");
scanf("%d",&p1->num);
printf("input the time of this car:");
scanf("%d",&p1->time);
while(p1->inf!=00)
{while(p1->inf==01)
{if(top1-base1<(max*sizeof(struct car)))
{ ****top1++=p1;****
n++;
printf("the car stopped at the %dth of the stack",n);
}
else
{rear->next=p1;
rear=p1;
j++;
printf("the car stopped at the %dth of the quene",j);
}
p1=(struct car*)malloc(sizeof(struct car));
printf("input the information of this car:");
scanf("%d%d%d",&p1->inf,&p1->num,&p1->time);
}
while(p1->inf==10)
{while(p1->num!=(--top1)->num)
{
**** top2++=(--top1);*****
time1=p1->time-(--top1->time);
printf("the car has stopped %d minuters\n",time1);
printf("you should pay for %d*x yuan\n",time1);
}
while(top2!=base2)
top1++==(--top2);
while(front!=rear)
{ p2=front->next;
front->next=p2->next;
p2->time=p1->time;
***** top1++=p2;*******
if(rear==p2)
rear=front;
p1=(struct car*)malloc(sizeof(struct car));
printf("input the information of this car:");
scanf("%d%d%d",&p1->inf,&p1->num,&p1->time);
}
if(p1->inf==0)
break;
}
printf("thank you for using this system\n");
}
}的