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

📄 game2.cpp

📁 这是个数据结构课程设计!功能强大。不信你下载下来看一看!
💻 CPP
字号:
#include "cpp3.h"
void Joseph(SeqList c[],int length)
{
	int m;
	cout<<"please input first interval m(m<=20)";
	cin>>m;
	while(m>20)
	{
		cout<<"It's too large.please input another number:\n";
		cin>>m;
	}
	cout<<"please input code:"<<endl;
	getchar();
	char s[10];
	for(int i=0;i<length;i++)
	{
		cout<<"第"<<i+1<<"个人的名字:";
		gets(s);
		c[i].SetName(s);
	}
	i=-1;
	int j,k;
	for (k=1;k<=length;k++)
	{
		j=0;
		while(j<m)
		{
			i++;
			if(i==length)
				i=0;
			if(c[i].GetNum()!=0)
				j++;
		}
		if(k==length)
			break;
		c[i].DispName();
		cout<<",";
		c[i].SetNum(0);
	}
	c[i].DispName();
	cout<<endl;
}
void game1()
{
	const int n=30;
	int length=0;
	cout<<"please input the number of people:";
	cin>>length;
	SeqList c[n];
	for(int i=0;i<length;i++)
	{
		c[i].SetNum(i+1);
		c[i].SetName(" ");
	}
	Joseph(c,length);
}

⌨️ 快捷键说明

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