⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ysf.c

📁 SQL源代码与论坛连接代码
💻 C
字号:
#include<stdio.h>
#include<stdlib.h>
typedef struct LNode{
int number;
int code;
struct LNode * next;
}LNode,*Linklist;
Linklist p,q;
struct LNode *creat(int b)
{
    struct LNode *L;
    int i;
    L=(Linklist)malloc(sizeof(LNode));
	q=L;
    q->number =1;
    printf("please enter the code of number 1  ");
    scanf("%d",&q->code);
    for(i=2;i<=b;i++)
	{p=(Linklist)malloc(sizeof(LNode));
	q->next=p;
	p->number=i;
	printf("please enter the code of number %d  ",i);
	scanf("%d",&p->code);

	q=p;}
	q->next=L;
return L;
}
void outqueue(struct LNode *L,int c,int b)
{
   int a;
   a=b;
    p=L;
	while(a>1)
	{
	 for(;c>1;c--)
	   {
	      q=p;p=p->next;
	   }
	   printf("%d,",p->number);
	   c=p->code;
	   q->next=p->next ;
	   free(p);p=q->next;
	   a--;
	}
	printf("%d\n",p->number);
}
void main(){
Linklist L;
int m,n;

printf("please enter the total of people\n");
scanf("%d",&n);
L=creat(n);
printf("please enter the start code\n");
scanf("%d",&m);
outqueue(L,m,n);
getch();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -