//---------------------------------------------------
//可创建任意长的链表
//---------------------------------------------------
#include
void main()
{
struct list
{
int name;
list *PN;
};
list *head;
list *ps;
list *pend;
ps=new list;
cout<<"输入0表示结束输入";
cin>>ps->name;
head=NULL;
pend=ps;
while(ps->name!=0)
{
if(head==NULL)
head=ps;
else
pend->PN=ps;
pend=ps;
ps=new list;
cin>>ps->name;
}
pend->PN=NULL;
delete ps;
while(head)
{
cout<
}
}