Question: Use C++ to create a program that controls the movements of an object in a 10x10 grid. Initially, the object is at position (0, 0).
9 0 1 23 4 5 6 7 8 9 The new grid after executing the sequence: up(S), turn_right(5), down(2) will look like this: 9 8 6 0 0 1 23 45 6 789 The program takes commands from a user as shown in the following example: Controller Menu: 1. Up 2. Down 3. Turn Right 4. Turn Left 5. Reboot 6. Show Grid 7. Exit Command "6. Show Grid" displays the grid. Command "7. Exit allows exiting the program. A. Implement the controller's functionalities. Add necessarily checks to ensure that the object does not go out of the grid. Your program should be structured using functions. For example, each command should be implemented in a separate function. (25 marks) we want to add the following commands (25 marks): B. - cancel (n:The program cancel the last n operations and return the object to the initial position - replay (n): The program replays the last n operations that have been cancelled. -position: The problem displays the position of the object
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
