cout <<"\nThe winner is "<<*iter.Current() << endl;
delete[]ap;
}
//
int* Init(int n)
{
int* a = new int[n];
for(int i=0; i<n; i++){
a = n - i;
Display(i+1);
josephus.Add(&a);
}
Display ( -1 );
iter.Restart(); //
return a;
}
//
void Display(int n)
{
static int k;
if(n<0){
k = 0;
cout <<endl;
return;
}
cout <<setw(4) <<n;
if (!(++k%10))
cout <<endl;
}
//m
void Step(int m)
{
for(int i=0; i<m; i++){
curpos = iter.Current();
iter++;
if(!iter.Current()) //
iter.Restart();
}
}
cd /downsoft/C++/book/Josephus/
g++ -o jose6 jose6.cpp
jose6.cpp:8:28: classlib\listimp: No such file or directory
jose6.cpp:69:1: warning: no newline at end of file
Compilation exited abnormally with code 1 at Tue Jul 20 20:03:25