私はこのようなコードを持っています:
class oBT{
public: void clean(int**);
void write(int**);
bool check(int**);
void backtrack(int**,int);
};
void oBT::clean(int R[8][8])
{ for(int i=1; i<=8; i++) for(int j=1; j<=8; j++) R[i][j]=0; }
void oBT::write(int R[8])
{
for(int i=1; i<=8; i++)
{
for(int j=1; j<=8; j++)
std::cout<<R[i]<<' ';
std::cout<<'\n';
}
std::cout<<'\n';
}
bool oBT::check(int R[8], int i=1)
{
for(int j=1; j<=8; j++)
{
for(int k=1; k<=8; k++)
{
if(R[i]==R[j]) return false;
if(R[j]==R[j]) return false;
}
i++;
}
return true;
}
void oBT::backtrack(int R[8], int i=1)
{
for(int j=1; j<=8; j++)
for(int k=1; k<=8; k++)
{
R[j]=1;
if(check(R))
if(i<8) backtrack(R,i+1);
else { write(R); clean(R); }
}
}
コンパイルしようとすると、次のエラーが発生します。
C:\OJI\Eight Queen Puzzle\Class.h|8|error: prototype for 'void oBT::clean(int (*)[8])' does not match any in class 'oBT'|
C:\OJI\Eight Queen Puzzle\Class.h|2|error: candidate is: void oBT::clean(int**)|
C:\OJI\Eight Queen Puzzle\Class.h|11|error: prototype for 'void oBT::write(int*)' does not match any in class 'oBT'|
C:\OJI\Eight Queen Puzzle\Class.h|3|error: candidate is: void oBT::write(int**)|
C:\OJI\Eight Queen Puzzle\Class.h|22|error: prototype for 'bool oBT::check(int*, int)' does not match any in class 'oBT'|
C:\OJI\Eight Queen Puzzle\Class.h|4|error: candidate is: bool oBT::check(int**)|
C:\OJI\Eight Queen Puzzle\Class.h|36|error: prototype for 'void oBT::backtrack(int*, int)' does not match any in class 'oBT'|
C:\OJI\Eight Queen Puzzle\Class.h|5|error: candidate is: void oBT::backtrack(int**, int)|
||=== Build finished: 8 errors, x warnings ===|