### Recursive Minesweeper

Hello, as the title states, I am trying to code a recursive minesweeper game. I feel like I have the general idea down, but I am having trouble with implementation. Here is what I have so far. Any help?
 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485`` ``````#include using namespace std; int sweep (int (&a)[5][5], int row, int column, int temp1, int temp2) { int countrow = temp1; int countcolumn = temp2; if (a[row][column] == 1) { a[row][column] = 0; if (row < temp1+1) { countrow++; sweep (a, countrow, column, temp1, temp2); } else if (row > temp1-1) { countrow--; sweep (a, countrow, column, temp1, temp2); } if (column < temp2+1) { countcolumn++; sweep (a, row, countcolumn, temp1, temp2); } else if (column > temp2-1) { countcolumn--; sweep (a, row, countcolumn, temp1, temp2); } } } int main(){ int row = 0; int column = 0; int temp1 = 0; int temp2 = 0; int a[5][5]={{0,0,0,0,0}, {0,1,1,1,0}, {0,1,1,1,0}, {0,0,1,0,1}, {0,0,1,0,0}}; cout << "Please enter row number." << endl; cin >> row; cout << "Please enter column number." << endl; cin >> column; temp1 = row; temp2 = column; sweep(a, row, column, temp1, temp2); for (int i = 0; i < 5; i++) { cout << endl; for (int j = 0; j < 5; j++) { cout << a[i][j]; } } } ``````
Topic archived. No new replies allowed.