Answer the question
In order to leave comments, you need to log in
How to implement data entry through space in C#?
By the way, if after the beginning of the loop you need to enter the elements of the array and at the same time do not press Enter to enter a new element, but separate them with spaces. How can I do that ?
Answer the question
In order to leave comments, you need to log in
Read a string of type string
Split the string into parts using string.Split, the separator is a space Parse
each part into a number in some way
More or less like this:
string test = Console.Readline();
string[] temp = test.Split(new Char[] {' '});
foreach(string item in temp)
{
int num = int.Parse(item);
//Обрабатываем каждое число отдельно.
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question