D
D
djEban2018-09-16 16:18:26
C++ / C#
djEban, 2018-09-16 16:18:26

How in c# to make keyboard input memorized in one line?

What I mean? For example, in c++ you can write like this:
Variables x, y. You need to enter their values ​​from the keyboard. std::cin >> x >> y; In this case, you can enter values ​​separated by a space and they will be remembered. Or in pascal readln(x, y).
How to do it in c#? The ReadLine command only works on one variable.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
#
#, 2018-09-16
@mindtester

there are no direct analogues, the string will have to be parsed
, for example, Split separated by a space (well, or the expected set of possible separators), and parsing of the expected value types, such as Int32.TryParse (the method is implemented for all basic numeric types)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question