Here is full code. However, I get weird results when I check for a queen.

Code:

#include <iostream>
using namespace std;
int board[8][8];
void resetBoard();
void displayBoard();
void addQueen(int row, int column);
void removeQueen(int row,int column);
void solve(int n, int column, int row);
bool isPathViable(int row, int column);
bool isPathSuccess(int row, int column);
int main()
{
int n=8;
resetBoard();
/*for(int i=0; i < n; ++i)
solve(n,0,i);*/
addQueen(3,2);
addQueen(3,3);
displayBoard();
cout << isPathViable(3,3);
return 0;
}
void resetBoard()
{
for(int i=0; i < 8; ++i)
for(int j=0; j < 8; ++j)
board[i][j]=0;
}
void displayBoard()
{
for(int i=0; i < 8; ++i)
{
for(int j=0; j < 8; ++j)
cout << board[i][j] << " ";
cout << "\n";
}
}
void addQueen(int row,int column)
{
board[row][column]=1;
}
void removeQueen(int row,int column)
{
board[row][column]=0;
}
void solve(int n,int row, int column)
{
addQueen(row,column);
if(isPathSuccess(row,column))
displayBoard();
else if(isPathViable(row,column))
for(int i=0; i < n; ++i)
solve(n,i,column+1);
removeQueen(row,column);
}
bool isPathViable(int row, int column)
{
for(int i=column;i >= 0; --i) //Checks row
{
if(board[row][i]==1)
return false;
}
for(int j=row, k=column ; row >= 0, column >= 0;--row, --column) //Checks left and up diagonal
{
if(board[j][k]==1)
return false;
}
for(int u=row, h=column ;row >= 0,column >= 0;++row,--column) //Checks left and down diagonal
{
if(board[u][h]==1)
return false;
}
return true;
}
bool isPathSuccess(int row, int column)
{
int queens=0;
for(int i=0; i < 8;i++)
for(int j=0;j < 8;j++)
if(board[i][j]=1)
++queens;
if(queens==8 && isPathViable(row,column))
return true;
else
return false;
}