程序运行不出来,哪里有问题啊?
#include <iostream>
using namespace std;
typedef struct slist{
int data;
slist *next;
}slist,*Linklist;
int createlist(Linklist &L)
{
slist *p,*q;
L=new slist;
L->next=NULL;
p=new slist;
cin>>p->data;
if(p->data=='0')
return 0;
L->next=p;
while(p->next!=NULL)
{
q=new slist;
cin>>q->data;
if(q->data=='0')
{
p->next=NULL;
delete q;
break;
}
p->next=q;
p=q;
}
return 1;
}
int outputlink(slist *head)
{
slist *p;
int data;
p = head;
while(p->next != NULL)
{
data = p->data;
cout << data;
p = p->next;
}
return 1;
}
int main()
{
slist *p1Link;
cout<<"ÇëÊäÈ뼯ºÏa:";
createlist(p1Link);
cout<<"¼¯ºÏaΪ:";
outputlink(p1Link);
cout<<endl;
return 0;
}