www.pudn.com > uuuDFdf5.rar > ysf.c
#include#include 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();}