Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use C language only (AND NOT C# or C++ or java or any other language.) Requirement: let user input a coordinate in following format (x,
Use C language only (AND NOT C# or C++ or java or any other language.) Requirement: let user input a coordinate in following format (x, y) as a start point, Then continuously let user enter a set of command and update the coordinate accordinging. The command must use the following (l - for left, r - for right, d - down, u - up, s - stop). For example, if initial position is given x = 5, y =6. (5, 6) And if command key (l) is entered. Then an application will output new line call "Current location is (4, 6)" without interrupting. Then, the application will continue to prompt user for another command without interrupting "please press next command". Then, If a letter other than the 5 allowed letter (l, r, d, u, s) here is entered. The application will output message "command exception, last location is (4, 6)" and without interrupting Then, If command key (d) is pressed. The application will update the position from (4, 6) to (4, 5) and output the following message "current location is (4, 5)." without interrupting Then, If the command (r) is pressed. The application will continue to update from last location (4, 5) and output new message "current location is (5, 5)". without interrupting Then, If command key (u) The application will update the position from (5, 5) and output new message "current location is (5, 6)". without interrupting Finally, If the command (s) is pressed, the application will repeat the last position (5, 6) and output message "location is (5, 6)" application will stop
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