user-0 提问: 初入茅庐的新手  来大神解答一下  急需！！！！

回复:
user: user-1
content: #include<stdio.h> #include<stdlib.h> #include<malloc.h>  #define OK 1 #define ERROR 0 #define TRUE 1 #define FALSE 0 #define INFEASIBLE -1 #define OVERFLOW -2 #define SIZE 10 #define STACK_INC_SIZE      5 typedef int Status;  typedef struct Car1{     int number;     int ar_time; }CarNode;  typedef struct{     CarNode *base;     CarNode *top;     int size;     int stacksize; }Park;  typedef struct Car2{     int number;     int ar_time;     struct Car2 *next; }*CarPtr;  typedef struct{     CarPtr front;     CarPtr rear;     int length; }Shortcut;  Status InitStack(Park &P) {     P.base = (CarNode*)malloc(SIZE*sizeof(Car1));     if(!P.base)         exit(OVERFLOW);     P.top = P.base;     P.size = SIZE;     P.stacksize = 0;     return OK; } Status Push(Park &P,CarNode e) {     if (P.top - P.base >= SIZE) {         P.base = (CarNode *)realloc(P.base,                 (P.size + STACK_INC_SIZE) * sizeof(Car1));         P.size += STACK_INC_SIZE;     }     *(P.top++) = e;     ++P.stacksize;      return OK; } Status Pop(Park &P,CarNode &e) {     if(P.top==P.base) {         printf("停车场为空.");         return OK;     }     e=*--P.top;     --P.stacksize;     return OK; } Status InitQueue(Shortcut &S) {     S.front=S.rear=(CarPtr)malloc(sizeof(Car2));     if(!S.front)         exit(OVERFLOW);     S.front->next=NULL;     S.length=0;     return OK; }  Status EnQueue(Shortcut &S,int number,int ar_time) {     CarPtr p;     p = (CarPtr)malloc(sizeof(Car2));     if(!p)         exit(OVERFLOW);     p->number=number;     p->ar_time=ar_time;     p->next = NULL;     S.rear->next = p;     S.rear=p;     ++S.length;     return OK; }  Status DeQueue(Shortcut &S,CarPtr &w) {     if(S.length == 0) {         printf("通道为空.");         return OK;     }     w = S.front->next;     S.front->next = S.front->next->next;     --S.length;     return OK; }  Status Arrival(Park &P,Shortcut &S) {     int number,ar_time;     printf("请输入车牌号：");     scanf("%d",&number);     printf("进场的时刻:");     scanf("%d",&ar_time);     if(P.stacksize<SIZE)     {         CarNode c;         c.number=number;         c.ar_time=ar_time;         Push(P,c);         printf("该车应停在第%d号车道.\n",P.stacksize);     }     else     {         EnQueue(S,number,ar_time);         printf("停车场已满,请暂时停在便道的第%d个位置.\n",S.length);     }     return OK; }  Status Leave(Park &P,Park &P1,Shortcut &S) {     int number,le_time,flag=1,money,ar_time;     printf("请输入车牌号：");     scanf("%d",&number);     printf("出场的时刻:");     scanf("%d",&le_time);     CarNode e,m;     CarPtr w;     while(P.stacksize)     {         Pop(P,e);         if(e.number==number)         {             flag=0;             money=(le_time-e.ar_time)*2;             ar_time=e.ar_time;             break;         }         Push(P1,e);     }     while(P1.stacksize)     {         Pop(P1,e);         Push(P,e);     }     if (flag == 0)     {         if(S.length!=0)         {             DeQueue(S,w);             m.ar_time=le_time;             m.number=w->number;             Push(P,m);             free(w);             printf("车牌号为%d的车已由便道进入停车场\n",m.number);         }         printf("停车费为%d, 占用车位数为%d\n",money,P.stacksize);     }     else     {         printf("停车场不存在牌号为%d的车\n", number);     }     return OK; } int main() {     int m=1;     char flag = 0;     Park P,Q;     Shortcut S;     InitStack(P);     InitStack(Q);     InitQueue(S);     while(m)     {         printf("\n 停车场管理程序 \n");         printf("\n");         printf("请选择(A,D,E): ");         scanf("%c",&flag);         switch(flag)         {             case 'A':             case 'a':                 Arrival(P,S);break;             case 'D':             case 'd':                 Leave(P,Q,S);break;             case 'E':             case 'e':                 m=0;                 break;             default:                 printf("Input error!\n");                 break;         }         getchar();         /*         printf("请选择(A,D,E): ");         while (flag != '\n')             scanf("%c",&flag);             */     } } 参考一下吧