Question
English description Write a C++ program which allows a user to traverse a 5x5 grid until the user wants to quit. The current position of
English description
Write a C++ program which allows a user to traverse a 5x5 grid until the user wants to quit. The current position of the user is shown after each move. The user starts in the upper left corner on the screen and can at each turn move to the left, right, up or down. The user indicates moves by the following letter inputs (all other letters quit the execution of the program):
'l' or 'L' for left
'r' or 'R' for right
'u' or 'U' for up
'd' or 'D' for down
The user never moves out of the grid. If the user's current position is, for example, in the left-most column and inputs 'l'/'L' then the user moves to the right-most column. If the user's current position is, for example, in the bottom row and inputs 'd'/'D' then the user moves to the top row. The current position of the user is denoted with 'o' on the screen but other points in the grid are shown as 'x'.
Dmi 1 / Example 1
o x x x x x x x x x x x x x x x x x x x x x x x x r x o x x x x x x x x x x x x x x x x x x x x x x x r x x o x x x x x x x x x x x x x x x x x x x x x x d x x x x x x x o x x x x x x x x x x x x x x x x x d x x x x x x x x x x x x o x x x x x x x x x x x x r x x x x x x x x x x x x x o x x x x x x x x x x x r x x x x x x x x x x x x x x o x x x x x x x x x x r x x x x x x x x x x o x x x x x x x x x x x x x x q
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started