国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

JOSEPH環

2019-11-17 05:39:37
字體:
來源:轉載
供稿:網友

  #include<stdio.h>
typedef strUCt Node
{
 int number;
 int cipher;
 struct Node *next;
}node,*hu;
hu H;//定義頭結點為H;
init(int n)
{
  int i;
  int cipher;
  hu L;
  if(n>=1)
  {
    scanf("%d",&cipher);
    H=(hu)malloc(sizeof(node));//生成頭結點;
    H->number=1;
    H->cipher=cipher;
    H->next=H;
    for(i=1;i<n;i++)
    {
      scanf("%d",&cipher);
      L=(hu)malloc(sizeof(node));//生成副結點;
      L->number=i+1;
      L->cipher=cipher;
      L->next=H->next;
      H->next=L;
      H=L;
    }
    H=H->next;//循環單鏈表的生成;
  }
  else
    }
Joseph(int m,hu h)//進行程序的循環,使順序出列;
{
  int i;
  hu l;
  l==h;
  i=1;
  while(i!=m)
  {
    i=i+1;
    l=h;
    h=h->next;
  }
  printf("%3d",h->number);
  m=h->cipher;
  l->next=h->next;
  free(h);
  h=l->next;
  if(h!=l)
    Joseph(m,h);
  else
  {
    printf("%3d",h->number);
    free(h);
  }
}
main()
{
 int m;
 int n;
 int i;
 clrscr();
 printf("Please input the starting value of M ( the upper limit worth of M ) : ");
 scanf("%d",&m);
 printf("Please input the man's figure who have a hand in: ");
 scanf("%d",&n);
 printf("Please input the cipher from number1 to number%d:",n);
 init(n);
 printf("The order of Dequeue is :");
 Joseph(m,H);
}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 遂宁市| 铜陵市| 富民县| 岳西县| 千阳县| 格尔木市| 望奎县| 民权县| 邻水| 成都市| 利川市| 龙岩市| 土默特右旗| 合江县| 图们市| 浦东新区| 乐平市| 富裕县| 龙陵县| 莱阳市| 托克逊县| 芒康县| 东山县| 正蓝旗| 阆中市| 抚松县| 博爱县| 周至县| 天祝| 江阴市| 宁武县| 于都县| 孝感市| 奉新县| 博野县| 大埔区| 荆州市| 扎鲁特旗| 佛坪县| 孟州市| 八宿县|