#include<stdio.h>
#include<iostream>
using namespace std;
typedef int Elemtype;
typedef struct node {
Elemtype data;
struct node* next;
};
node* Greatlist(int n)
{
node*p, *r, *list = NULL;
r = (node*)malloc(sizeof(node));
int i;
Elemtype c;
for (i = 1; i <= n; i++)
{
cin >> c;
p = (node*)malloc(sizeof(node));
p->data = c;
p->next = NULL;
if (list == NULL)
{
r=list = p;
}
else
{
r->next = p;
r = p;
}
}
return list;
}
int Linklen(node*list)
{
int count = 0;
node* p = list;
while (p!=NULL)
{
count++;
p=p->next;
}
return count;
}
int main()
{
node*l;
cout << "input 10 interger:" << endl;
l = Greatlist(10);
cout << "the length is:" << Linklen(l) << endl;
return 0;
}