C++ implementation of backtracking method for solving maze problem