Consider the following maze:
The maze begins at S and ends at E. We represent the current position in the maze using two integer variables named posX and posY. The starting location (S) is thus represented as posX = 0 and posY = 0. Movement through the maze is defined by the following rules:
1. MoveRight(spaces): posY = posY + spaces
2. MoveLeft(spaces): posY = posY – spaces
3. MoveDown(spaces): posX = posX + spaces
4. MoveUp(spaces): posX = posX – spaces
Define functions for each of the above rules such that each function has an integer reference parameter. Use these function declarations to write a C++ program that defines posX and posY, initialized to 0, and the corresponding calls to your functions that will correctly move your position in the maze from S to E ending at posX = 0, posY = 11. Print out the value of posX and posY after each function call.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.