现在的位置: 首页 > 综合 > 正文

joseph

2013年09月30日 ⁄ 综合 ⁄ 共 570字 ⁄ 字号 评论关闭
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
typedef struct sqlist
{
int data;
int pw;
struct sqlist *next;
}sqlist;
main()
{
sqlist *p,*l,*q;
int n,i,m;
printf("please input the size you want to play:/n");
scanf("%d",&n);
p=malloc(sizeof(sqlist));
printf("please input password/n");
scanf("%d",&p->pw);
p->data=1;
for(i=1;i<n;i++)
{
  q=malloc(sizeof(sqlist));
  scanf("%d",&q->pw);
  q->data=i+1;
  q->next=p->next;
  p->next=q;
}
q->next=p;
­
l=p;
while(n--)
{printf("%d",l->data);
l=l->next;}
printf("please input the m:/n");
scanf("%d",&m);
for(i=0;i<n;i++)
{
  l=l->next;
  m=l->pw;
  printf("%d  ",l->data);
  
}
}

抱歉!评论已关闭.