将开发过程中比较重要的一些内容做个收藏,下面的内容是关于C语言解决约瑟夫问题详解的内容,希望能对码农有帮助。
#pragma once
#include<vector>
class PRO
{
private:
public:
~PRO();
};
#include"Josephus_pro.h"
#include<iostream>
using namespace std;
PRO::PRO(int tol_num,int sg_num,int reman_num ,int bg_num)
{
total_num = tol_num;
sig_num = sg_num;
begin_num = bg_num;
remaining_num = reman_num;
}
{}
PRO::~PRO()
{}
void PRO::Running()
{
while(sum > remaining_num)
{
while(i < sig_num)
{
i++;
}
if(arr[index] == 0)
else
}
}
void PRO::input()
{
cout<<"请输入"<<total_num<<"个数据:"<<endl;
cin>>arr[i];
}
void PRO::PutResult()
{
cout<<"计算结果如下:"<<endl;
for(vector<int>::size_type i=0;i<vec_int.size();i++)
cout<<"第"<<i+1<<"个被踢出去的数字:"<<vec_int[i]<<endl;
cout<<"剩余人:"<<endl;
for(int i=0;i<total_num;i++)
{
if(arr[i] == 0)
continue;
if(arr[i] != 0)
}
}