源代码有问题,关于解决停车场的课程设计
# include <stdio.h># include <stdlib.h>
//停车场
struct stack1
{
unsigned char p1[10];
struct stack1 *next;
}M;
struct stack2
{
unsigned char p2[10];
struct stack2 *next;
}N;
struct L
{
struct stack1 *k;
struct stack2 *l;
};
struct stack1 *p;
struct stack2 *q;
void InitStack()
{
p=(struct stack1 *) malloc (5 * sizeof (M));
q=(struct stack2 *) malloc (5 * sizeof (N));
}
void CleanStack (struct stack1 *x,struct stack2 *y)
{
int i;
for (i=0;i<=4;i++)
{
x->p1={"0,0,0,0,0,0,0,0,0,0"};
x=x->next ;
}
for (i=0;i<=4;i++)
{
y->p2 ={"0,0,0,0,0,0,0,0,0,0"};
y=y->next ;
}
}
struct L * InStack (struct stack1 *m,struct stack2 *n)
{
int i;
struct L *vio;
for (i=0;i<=4;i++)
{
scanf ("%s",&m->p1 );
m=m->next ;
if (i>4)
{
for (i=5;i<=10;i++)
{
scanf ("%s",&n->p2 );
n=n->p2 ;
}
}
}
vio->k =m;
vio->l=n;
return (vio);
}
void PopStack (struct stack1 *a,struct stack2 *b)
{
struct stack1 *j,*t;
t=a;
scanf ("%s",&j->p1 );
while (j->p1 !=a->p1 )
{
a--;
b->p2 =a->p1 ;
b=b->next ;
}
while (a!=t)
{
b--;
a->p1 =b->p2 ;
}
}
void ViewStack (struct stack1 *a,struct stack2 *b)
{
int i;
for (i=0;i<=4;i++)
{
a--;
printf ("%s",a->p1 );
a=a->next ;
}
do
{
b--;
printf ("%s",b->p2 );
b=b->next ;
} while (b->p2 !=NULL);
}
void MainMinue()
{
printf ("1.车辆进站。\n");
printf ("\n");
printf ("2.车辆出站。\n");
printf ("\n");
printf ("3.显示现有车辆。\n");
ptintf ("\n");
printf ("4.退出系统。\n");
printf ("\n");
}
int mian()
{
int i;
struct stack1 *new1,*new2;
struct L *v;
void MainMinue();
scanf ("%d",&i);
while (i!=5)
{
if (i==1)
{
void InitStack();
void CleanStack (p,q);
v=struct L * Instack (p,q);
}
if (i==2)
{
void PopStack (v->k;v->l);
}
if (i==3)
{
void ViewStack (v->k;v->l);
}
scanf ("%d",&i);
}
return 0;
}