bool pathExists(string maze[], int nRows, int nCols, int sr, int sc, int er, int ec)

{

// Return true if there is a path from (sr,sc) to (er,ec)

// through the maze; return false otherwise

}

int main()

{

string maze[10] = {

“XXXXXXXXXX”,

[email protected]“,

[email protected]@@[email protected]“,

“X….XXX.X”,

[email protected]“,

“X..XX.XX.X”,

“X…X….X”,

“XXXXXXXXXX”

};

if (pathExists(maze, 10, 10, 6, 4, 1, 1))

cout << “Solvable!” << endl;

else

cout << “Out of luck!” << endl;

return 0;

}

  • Attachment 1
  • Attachment 2
  • Attachment 3

2. Write a C++ function named pathExists that determines whether or not a there’sa path from start to finish in a rectangular maze. Here is the prototype:bool pathExists (string maze, int nRows, int nCols,int sr, int so, inter, int ec) ;/ / Return true if there is a path from (sr, sc) to (er, ec)// through the maze; return false otherwiseThe parameters are:A rectangular maze of Xs and dots that represents the maze. Each string of thearray is a row of the maze.Each ‘X’ represents a wall, each ‘@’ represents a bottomless trap hole, and each&quot; represents a walkway.. The number of rows in the maze.

"Get 15% discount on your first 3 orders with us"
Use the following coupon
FIRST15

Order Now