⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 josphe.cpp

📁 josphe算法的实现,包含一个头文件
💻 CPP
字号:
// jo.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "josphe.h"
extern  josphe* phead;
extern  josphe* ptail;
extern  int ncount;


int main(int argc, char* argv[])
{
	 
      ncount=0;
	josphe* p;
	int remain,count=0;
	for(int i=1;i<=10;i++)
	{
		p=new josphe;
		p->add(i);
		ncount++;
	}
	cout<<"原来的号码:";
	phead->list_all();
	cout<<endl;
	remain=ncount;
	p=phead;
	while(remain>2)
	{
		while(count<2)
		{
			count++;
		    p=p->next;
			
		}
		remain--;
		count=0;
		p=p->del();
	}
	cout<<"剩下的号码:";
	phead=p;
	p->list_all();
	cout<<endl;
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -