网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > C/C++
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
本月文章推荐
.成为嵌入式程序员应知道的0x10个.
.C++中巧用#define访问类的私有成.
.new和delete导致的内存分配问题详.
.C++ Builder 初学问与答 (九).
.C++中控制Windows关机的实用技巧.
.Macro Definitions of Functions.
.罗云彬VxD教程--虚拟8086模式的内.
.GTK+与MFC不完全对比.
.More Effective C++:指针与引用.
.C++中的虚函数(virtual function).
.GCC常用命令描述.
.在未来时态下开发C++程序.
.对《QQ列表精灵》源代码分析和仿.
.读取注册表中一个子键下的所有子.
.C语言初学者的困惑--如何由dos向.
.花心.
.C语言初学者入门讲座 第二讲 数据.
.在Visual C++应用程序中彻底清除.
.C趣味编程百例(06).
.在CB中用socket api来写网络通讯.

JOSEPH环

发表日期:2008-3-8



  #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
    printf("The N's value that you inputted is invalid!");
}
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);
}
上一篇:C++中理解“传递参数”和异常之间的差异 人气:497
下一篇:MCI(媒体控制接口)相关知识 人气:673
浏览全部C/C++的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐