循环链表实现 /(ㄒoㄒ)/~~ 太不容易了!!! 值得纪念!!!
// 10.2.1链表实现 !!!! 太不容易了 /(ㄒoㄒ)/~~ !!!!
#include<stdio.h>
#include<stdlib.h>
struct node{
int data;
struct node *next;
};
struct node *create( int n ); //构建循环链表
void myfree( struct node *head,int n ); //释放循环链表,其中n为链表的结点个数
void print( struct node *head,int n ); //打印循环链表的一轮,其中nwei链表的结点个数
int delete_list( struct node *head,int n,int s ); //实现题目的内容
int main()
{
struct node *head;
int n,s,i,len;
printf("请输入有多少人,从第几人开始报数!\n");
scanf("%d%d",&n,&s);
head=create( n );
printf("未删除的结点:\n");
print( head,n );
printf("\n");
len=delete_list( head,n,s );
printf("\nlen=%d\n",len);
myfree( head,n );
return 0;
}
//构建循环链表,在链尾插入
struct node *create( int n )
{
int