#include "stdio.h"
#include "iostream"
#include "malloc.h"
#include "stdlib.h"
#include "math.h"
using namespace std;
typedef int ElemType;
typedef struct LNode
{
ElemType data;
struct LNode *next;
}LinkList;
int main()
{
int i,d,m;
LinkListL,p,s;
cout << "输入你想要输入多少个数:";
cin>>m;
cout << "建立单链表"<<endl;
s=L;
for(i=1;i<=m;i++)
{
p=(LinkList)malloc(sizeof(LNode));
cin >> d;
p->data=d;
s->next=p;
s=p;
}
p->next=NULL;
cout <<"输出:"<<endl;
p=L->next;
for(i=1;i<=m;i++)
{
cout << p->data<<" "<<endl;
p=p->next;
}
return 0;
}