#include<iostream>
using namespace std;
typedef struct student
{
int no;
int mm;
struct student*next;
}student,*linklist;
void Initlist(linklist &L)
{
L=new student;
L->next=L;
}
void ListInsert(linklist L,int i,int mm)
{
student *p;
p=L;
for(int j=1;j<=i-1;j++)
p=p->next;
student *newstudent;
newstudent=new student;
newstudent->no=i;
newstudent->mm=mm;
newstudent->next=p->next;
p->next=newstudent;
}
void listtran(linklist L)
{
student *p;
p=L->next;
while(p!=L)
{
cout<<"--c"<<p->no<<","<<p->mm;
p=p->next;
cout<<endl;
}
}
void yeseful(linklist L,int m)
{
student *p;
p=L;
while(L->next!=L)
{
for(int i=1;i<=m-1;i++)
{
p=p->next;
if(p==L)
p=p->next;
}
if(p->next==L)
p=p->next;
cout<<p->next->no<<endl;
m=p->next->mm;
student *del=p->next;
p->next=del->next;
delete del;
}listtran(L);
}
void main()
{
// int m=20;
// int mm[]={3,1,7,2,4,8,4};
// int n=sizeof(mm)/sizeof(mm[0]);
linklist L=NULL;
for(int i=0;i<n;i++)
{
ListInsert(L,i+1,mm[i]);
listtran(L);
}
yeseful(L,m);
listtran(L);
}
ysf.rar_ysf文件
版权申诉
163 浏览量
2022-09-14
18:55:28
上传
评论
收藏 856KB RAR 举报
我虽横行却不霸道
- 粉丝: 75
- 资源: 1万+
最新资源
- 封装swagger组件,提供全新UI以及无状态登录接口调用解决方案
- 小龙坎支局2024年4月渠道积分核对数据.xlam
- onlyoffice搭建及与alist使用的view.html
- Quadcopter-UAV-attitude-estimation-linux常用命令大全demo
- Quadcopter-UAV-attitude-estimation-based-on-数据库课程设计
- pbdlib-python-master.zip
- 43904245495352013_base.apk
- 基于springboot+vue + redis的工作流审批系统
- 【qt基础语法及实际案例解析】qt基础语法及实际案例解析
- 结课作业.psd
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0