I need help with my code, What is wrong with it? It is supposed to print the maze every time the function is called.
#include <iostream> using namespace std; const int ROWMAX = 4; const int COLMAX = 3; char maze[ROWMAX][COLMAX] = { { " " }, { " + +-+ " }, { " | | " }, { " +-+ + " }, { " | | " }, { " +-+-+ " }, { " | | " }, { " +-+ + " }, { " " }, }; void printMaze(); void runMaze(int, int); void runMaze(int row, int col) for(int row = 0; row < ROWMAX; row++) { for(int col=0; col < COLMAX; col++) cout << maze[row][col]; cout << "\n"; } void runMaze(int row, int col) { if( (row>0 && row<ROWMAX) && (col>0 && col<COLMAX)) { if( maze[row][col] == 'W' ) return; if( maze[row][col] == ' ') { maze[row][col]='*'; runMaze(row, col+1); runMaze(row, col-1); runMaze(row-1, col); runMaze(row+1, col); } } } int main() { cout << "Automatic Maze Solver" << endl; printMaze(); cout << "START" << endl; runMaze(1, 2); printMaze(); return 0; }