Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static int[] ReadIntArray()
- {
- int[] numsArray;
- bool flag = false;
- do
- {
- flag = true;
- string buff = Console.ReadLine();
- numsArray = new int[buff.Split(' ').Length];
- if (buff.Split(' ').Length > 120 || buff.Split(' ').Length < 1)
- {
- Console.WriteLine("Введите числа ещё раз, позязя!");
- flag = false;
- continue;
- }
- int i = 0;
- foreach (var item in buff.Split(' '))
- {
- if (!int.TryParse(item, out numsArray[i])
- || Math.Abs(numsArray[i]) > 1025)
- {
- Console.WriteLine("Введите числа ещё раз, позязя!");
- flag = false;
- continue;
- }
- i++;
- }
- } while (!flag);
- return numsArray;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement