Sign in
or
Register
Courses
Textbook
Compiler
Contests
Topics
Courses
C++. Robot
C++. Artist Robot
Module:
C++. Artist Robot
1
/9.
Meet the robot! Right Command (C++)
Silver can execute the
right;
command, upon receiving which he moves one square to the right, if possible.
Write a program that will move Silver to the base.
Type your program below
C++
Python
To check the solution of the problem, you need to register or log in!
Previous Submissions
Silversmith
×
Study
For the first time in the history of Russian cosmonautics, an anthropomorphic robot named Fedor (FEDOR) went into orbit. He has already said the most important word: "Let's go!"
In general, the main goal & nbsp; Fedora - to replace a person in places of increased risk - for example, in rescue operations and in space. A person sits in a safe place and sends commands to the robot, thereby he can control it, forcing it to perform various tasks. Agree, it is very convenient!
And this is just the beginning...
The future, no doubt, belongs to such robots! Do you want to learn how to control robots, write various programs and become a real programmer? Then you are on the right track!
We have created the same robot for you, and we will teach you how to control it!
Let's get acquainted!
This is Robot Silver.
Gradually, from task to task, you will learn how to manage it and together with it you will solve various tasks of exploring various planets.
Let's go!
Now Silver is at the training base and is working out the commands.
Let's explore what the robot knows about its environment.
The robot knows that the entire study area is divided into squares. It cannot go beyond this area, otherwise the mission will fail.
He also knows that there is a base on the field. The square with the base is indicated in green with a yellow border. If the Robot has completed the task, it must return to the base and the mission will be considered successful.
Let's practice driving Silver.
The robot can be controlled using C++ language syntax.
Silver can execute the command
right;
, upon receiving which he moves one square to the right, if possible.
It's important to remember that any C++ command ends with a semicolon(
;
)!
Robot Silver, like any robot or computer, obeys instructions blindly and literally. He cannot think for himself, so all actions and commands must be expressed unambiguously.
For example, if you give the Robot the command
to the right
, then it will not understand it!
Be careful!
Result
×