Function to print the bord
| 3 | |
| 4 | // Function to print the bord |
| 5 | void printBoard(std::vector<std::vector<int>> &board, int n) |
| 6 | { |
| 7 | for (int i = 0; i < n; ++i) |
| 8 | { |
| 9 | for (int j = 0; j < n; ++j) |
| 10 | { |
| 11 | if (board[i][j] == 1) |
| 12 | { |
| 13 | std::cout << 'Q' << ' '; |
| 14 | } |
| 15 | else |
| 16 | { |
| 17 | std::cout << '_' << ' '; |
| 18 | } |
| 19 | } |
| 20 | std::cout << std::endl; |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | // Function for checking valid squares. |
| 25 | bool canBePlaced(std::vector<std::vector<int>> &board, int i, int j, int n) |