Answer the question
In order to leave comments, you need to log in
How to enter data into a char continuously?
It is necessary to write a program that determines the coordinates, it is necessary to enter the coordinates for the North, South, West and East.
Example:
North 4
South 3
West 5
East 6
Output: 1 1
And the main problem when entering is to write the words server south and so on. and next remove through the space above write the number. And no matter what order to write the coordinates. help kindly.
Answer the question
In order to leave comments, you need to log in
We read from the input stream a line up to a space. If the line matches the name of the cardinal direction - remember the current direction. If the string is a number, increase/decrease the coordinate in the current direction by this number. If neither one nor the other - ignore or throw an error, as you like.
Wash off, repeat.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question