View difference between Paste ID: kdQQFp8K and C26sWULh
SHOW: | | - or go back to the newest paste.
1
using System;
2
3
namespace C_sharp_Light
4
{
5
    class Program
6
    {
7
        static void Main(string[] args)
8
        {
9-
            
9+
            int number=0;
10
            ConvertToInt(ref number);
11
            Console.WriteLine($"Выше число - {number}");
12
            Console.ReadKey();
13
        }
14
        static void ConvertToInt(ref int result)
15
        {
16
            string value;
17
            bool isCorest = false;
18
            while (!isCorest)
19
            {
20
                Console.Write("Введите число: ");
21
                value = Console.ReadLine();
22
                if (int.TryParse(value, out result))
23
                {
24
                    Console.WriteLine("Конвертация прошла успешно");
25
                    isCorest = true;
26
                }
27
                else
28
                {
29
                    Console.WriteLine("Конвертация прошла не успешно");
30
                    Console.ReadKey();
31
                    Console.Clear();
32
                }
33
            }
34
            Console.ReadKey();
35
            Console.Clear();
36
        }
37
    }
38
}