C++ Programming: From Problem Analysis to Program Design
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9781337102087
Author: D. S. Malik
Publisher: Cengage Learning
Bartleby Related Questions 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.
expand button
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.
SAVE
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
bartleby
Unlock instant AI solutions
Tap the button
to generate a solution
Click the button to generate
a solution
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr