#include<stdio.h>
#include<stdlib.h>
typedef struct lb
{ int x;
struct lb *next;
} lb;
void main (void)
{
lb *h,*h2,*h3,*p,*p2,*s,*s2;
int m=1,t=0,y;
scanf("%d",&y);
h=(lb*)malloc(sizeof(lb));
h->next=NULL;
while(y>=0)
{
s=(lb*)malloc(sizeof(lb));
s->x=y;
if(h->next=NULL)
h->next=s;
else p->next=s;
p=s; t++;
scanf("%d",&y);
}
p->next=NULL;
h3=h;
printf("输入的数据为:");
while( h->next!=NULL)
{
h=h->next;
printf("%5d",h->x);
s2=(lb*)malloc(sizeof(lb));
s2->x=h->x;
if(m==1)
s2->next=NULL;
else s2->next=p2;
p2=s2;
m++;
}
printf("/n输入的数据个数为:%4d,t");
h2=(lb*)malloc(sizeof(lb));
h2->next=p2;
printf("/n反向链接后将数据输出结果为:");
while( h2->next!=NULL)
{
h2=h2->next;
printf("%4d",h2->x);
}
}