|  | 
 
| 
#include<iostream>
x
马上注册,结交更多好友,享用更多功能^_^您需要 登录 才可以下载或查看,没有账号?立即注册  
 struct link
 {
 char date;
 link *next;
 };
 class yese
 {
 public:
 yese(int x);
 ~yese();
 void play();
 private:
 link *dat;
 };
 yese:: yese(int x)
 {
 link *fp,*team;  dat=NULL;
 for(int i=1;i<=x;i++)
 {
 fp=new link;
 fp->date=i;
 if(dat==NULL)
 {
 dat=fp;fp->next=dat;
 }
 else
 {
 team->next=fp;
 fp->next=dat;
 
 }
 team=fp;
 }
 dat=team;
 }
 yese:: ~yese()
 {
 delete dat;
 dat=NULL;
 
 }
 
 void yese:: play()
 {
 link *fp;
 while(dat->next!=dat)
 {
 fp=dat->next->next;
 dat=fp ->next;
 fp->next=dat->next;
 std::cout<<(int)dat->date<<"->";
 delete dat;
 dat=fp;
 }
 
 }
 
 
 int main()
 {
 yese k(16);
 k. play();
 return 0;
 }
 
 | 
 |