예제 #1
0
        static void Main(string[] args)
        {
            Console.Write("Введите радиус: ");
            float r = ConvertFloat.GetFloatValue();

            Round round;

            try
            {
                round = new Round(r);
            }
            catch (RoundException ex)
            {
                Console.WriteLine($"Ошибка! {ex.Message}");
                Console.ReadKey();
                return;
            }

            PrintInfo(round);
        }
예제 #2
0
        static void Main(string[] args)
        {
            float[] a = new float[3]; // Длины сторон
            for (int i = 0; i < 3; i++)
            {
                Console.Write($"Введите длину {i+1} стороны:");
                a[i] = ConvertFloat.GetFloatValue();
            }

            try
            {
                Triangle tr = new Triangle(a[0], a[1], a[2]);
                Console.WriteLine($"Периметр = {tr.Perimeter()}");
                Console.WriteLine($"Площадь = {tr.Square()}");
            }
            catch (TriangleException ex)
            {
                Console.WriteLine($"Ошибка! {ex.Message}");
            }
            Console.ReadKey();
        }
예제 #3
0
        static void Main(string[] args)
        {
            Console.Write("Введите радиус 1: ");
            float r = ConvertFloat.GetFloatValue();

            Console.Write("Введите радиус 2: ");
            float r2 = ConvertFloat.GetFloatValue();

            Ring ring;

            try
            {
                ring = new Ring(r, r2);
            }
            catch (RingException ex)
            {
                Console.WriteLine($"Ошибка! {ex.Message}");
                Console.ReadKey();
                return;
            }

            PrintInfo(ring);
        }