Been a long night, but stuck on this and now am getting "segmentation fault" in my compiler..
Basically I'm trying to display all the errors (the cout) needed. If there is more than one error, I am to display all of them.
bool validMove(const Square board[BOARD_SIZE][BOARD_SIZE],
int x, int y, int value)
{
int index;
bool moveError = true;
const int row_conflict(0), column_conflict(1), grid_conflict(2);
int v_subgrid=x/3;
int h_subgrid=y/3;
getCoords(x,y);
for(index=0;index<9;index++)
if(board[x][index].number==value){
cout<<"That value is in conflict in this row\n";
moveError=false;
}
for(index=0;index<9;index++)
if(board[index][y].number==value){
cout<<"That value is in conflict in this column\n";
moveError=false;
}
for(int i=v_subgrid*3;i<(v_subgrid*3 +3);i++){
for(int j=h_subgrid*3;j<(h_subgrid*3+3);j++){
if(board[i][j].number==value){
cout<<"That value is in conflict in this subgrid\n";
moveError=false;
}
}
}
return true;
}