Write a program that: Declare the following integer variables: Leftmotor Rightmotor Declare the following character arrays: lilac of size 50. - lea of size 30. Program 9 Repeat the steps below 10 times and then quit the program. Ask the user for a robot command and store it in a character array of size 50. Store the user input in lilac. The user input consist of up to two words inputted as one string. The motors are assigned values according to the string input and the table below. Also the input string could be one word or two words. If the first word is STOP then no further instruction is needed (no second word in the string). If the first word is move then a second word will follow First word Second word Left motor Right motor STOP 0 0 MOVE FORWARD 127 127 MOVE REVERSE -127 -127 MOVE MOVE LEFT RIGHT 64 127 127 64 The user input could be a mix of upper case and lower case letters so you need to change all the input to upper case before comparing with the instruction words.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.5: A Closer Look: Loop Programming Techniques
Problem 14E
icon
Related questions
Question
Write a program that:
Declare the following integer variables:
Leftmotor
Rightmotor
Declare the following character arrays:
lilac of size 50.
-
lea of size 30.
Program 9
Repeat the steps below 10 times and then quit the program.
Ask the user for a robot command and store it in a character array of size 50.
Store the user input in lilac.
The user input consist of up to two words inputted as one string. The motors are assigned
values according to the string input and the table below. Also the input string could be one
word or two words. If the first word is STOP then no further instruction is needed (no second
word in the string). If the first word is move then a second word will follow
First word
Second word
Left motor
Right motor
STOP
0
0
MOVE
FORWARD
127
127
MOVE
REVERSE
-127
-127
MOVE
MOVE
LEFT
RIGHT
64
127
127
64
The user input could be a mix of upper case and lower case letters so you need to change all the
input to upper case before comparing with the instruction words.
Transcribed Image Text:Write a program that: Declare the following integer variables: Leftmotor Rightmotor Declare the following character arrays: lilac of size 50. - lea of size 30. Program 9 Repeat the steps below 10 times and then quit the program. Ask the user for a robot command and store it in a character array of size 50. Store the user input in lilac. The user input consist of up to two words inputted as one string. The motors are assigned values according to the string input and the table below. Also the input string could be one word or two words. If the first word is STOP then no further instruction is needed (no second word in the string). If the first word is move then a second word will follow First word Second word Left motor Right motor STOP 0 0 MOVE FORWARD 127 127 MOVE REVERSE -127 -127 MOVE MOVE LEFT RIGHT 64 127 127 64 The user input could be a mix of upper case and lower case letters so you need to change all the input to upper case before comparing with the instruction words.
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning