#include<iostream>
#include<stdlib.h>
using namespace std;
#define null 0;
typedef struct cnode
{ int data;
int order;
struct cnode * next;
}cirlnode,*cirlist;
void initclist(cirlist &head)
{ head=new cirlnode;
head->next=null;//暂时定为空,之后的创建中会实现循环连接
}
cirlist creatcirlist(cirlist &head)
{ cirlist p=head;
int n;
cout<<"please rnter the number of your circul list";
cin>>n;
for(int i=1;i<=n;i++)
{ cirlist temp=new cirlnode;
cout<<"the element of your "<<i<<"th member";
cin>>temp->data;
temp->order=i;
p->next=temp;
temp->next=head;
p=p->next;
}
return head;
}
void printclist(cirlist head) //输出循环链表的所有元素
{
cirlist p;
p=head->next;
while(p!=head)
{
cout<<p->data;
p=p->next;
}
cout<<"finish\n";
}
int main()
{ cirlist l;
initclist(l);
creatcirlist(l);
printclist(l);
system("pause");
return 1;
}