- WinCE Security...
 - xdebug配置说明
 - VC++ 获取文件的创建、修...
 - ASP进度条
 - 简单代理服务器C代码实现(S...
 - 程序设计竞赛试题选(02)
 - 如何在ASP程序中打印Acc...
 - UTF-8和16进制区间
 - ASP实用技巧:强制刷新和判...
 - 运行中程序删除自己的方法
 - asp提高首页性能的一个技巧
 - [J2EE]J2EE 应用服务器技术
 - VB变量命名规范
 - C语言常见错误小结
 - (摘自网络)如何在IIS中调...
 
约瑟夫环C语言
/*约瑟夫环*/
#include <stdlib.h>
#include <stdio.h>
typedef struct node
{
 int data;
 struct node *next;
}LNode;
main()
{
 LNode* Create(int,int);
 LNode* GetNode(LNode *);
 int Print(LNode *,int);
 LNode *p;
 int n,k,m;
 do
 {
  printf ("输入总人数");
  scanf ("%d",&n);
 }
 while (n<=0);
 do
 {
  printf ("输入开始人的序号(1~%d)",n);
  scanf ("%d",&k);
 }
 while (k<=0 || k>n);
 do
 {
  printf ("输入间隔数字");
  scanf ("%d",&m);
 }
 while(m<=0);
 p=Create(n,k);
 Print(p,m);
 return 0;
};
LNode* Create(int n,int k)/*创建循环链表*/
{
 int start=k-1;
 LNode *s,*p,*L=0,*t;
 if (start==0) start=n;
 while (n!=0)
 {
  s=(LNode *)malloc(sizeof(LNode));
  if (L==0) p=s;
  if (n==start) t=s;
  s->data=n;
  s->next=L;
  L=s;
  n--;
 }
 p->next=L;
 return t;
}
LNode* GetNode(LNode *p)/*出队函数*/
{
 LNode *q;
 for (q=p;q->next!=p;q=q->next);
 q->next=p->next;
 free (p);
 return (q);
}
Print(LNode *p,int m)/*输出函数*/
{
 int i;
 printf ("出队编号:\n");
 while (p->next!=p)
 {
  for (i=1;i<=m;i++)
   p=p->next;
  printf ("%d ",p->data);
  p=GetNode(p);
 }
 printf("%d\n",p->data);
 return 0;
}