Hello, I'm trying to solve the 8 queens problem, but I need some help searching the 2D array. I understand how the algorithm works, but the problem I always have is applying that algorithm to code. I've posted what I have so far. I have to do it this way, so don't tell me to combine functions or anything like that. Searching arrays like this really confuses me for some reason, so any help is great. Thanks!

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 main() { resetBoard(); for(int i=1; i <= 8; ++i) //solve(...); 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()) displayBoard(); else if(isPathViable(row,column)) for(int i=1; i <= n; ++i) solve(n,i,column+1); } bool isPathViable(int row, int column) { for(int i=0; i < column; ++i) if(board[row][i]==1) return false; //Really confused on how to search this and check if a queen is safe else return true; } bool isPathSuccess() { 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) return true; else return false; }