Beispiel #1
0
 static void Divide(QuadraticTrinomial q1, QuadraticTrinomial q2, double x0)
 {
     try
     {
         Console.WriteLine(q1.Division(q2, x0));
     }
     catch (DivideByZeroException e)
     {
         Console.WriteLine("Деление на 0");
     }
 }
        static void Main(string[] args)
        {
            QuadraticTrinomial a = new QuadraticTrinomial(2, 3, 7);
            QuadraticTrinomial b = new QuadraticTrinomial(1, -5, 6);

            int[] x0 = new int[] { 1, -3, 3, 2, 7, 100, 0 };
            for (int i = 0; i < x0.Length; i++)
            {
                try
                {
                    Console.WriteLine($"{a.Division(b, x0[i]):f3}");
                }
                catch (DivideByZeroException e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }
        static void Main(string[] args)
        {
            QuadraticTrinomial t1 = new QuadraticTrinomial(2, 3, 7);
            QuadraticTrinomial t2 = new QuadraticTrinomial(1, -5, 6);

            double[] points = new double[] { 1, -3, 3, 2, 7, 100, 0 };
            foreach (double x in points)
            {
                try
                {
                    Console.WriteLine(t1.Division(t2, x));
                }
                catch (DivideByZeroException)
                {
                    Console.WriteLine($"Значение второго трёхчлена в точке {x} равно 0");
                }
            }
        }
        static void Main(string[] args)
        {
            QuadraticTrinomial quadraticTrinomial1 = new QuadraticTrinomial(2, 3, 7);
            QuadraticTrinomial quadraticTrinomial2 = new QuadraticTrinomial(1, -5, 6);

            foreach (double value in new int[] { 1, 3, -3, 2, 7, 100, 0 })
            {
                try
                {
                    Console.WriteLine($"Деление квадратного трехчлена {quadraticTrinomial1}" +
                                      $" на {quadraticTrinomial2} в точке {value} " +
                                      $"равно {quadraticTrinomial1.Division(quadraticTrinomial2, value)}");
                }
                catch (DivideByZeroException ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            QuadraticTrinomial q1 = new  QuadraticTrinomial(2, 3, 7);
            QuadraticTrinomial q2 = new QuadraticTrinomial(1, -5, 6);

            int[] x = new int[7] {
                1, -3, 3, 2, 7, 100, 0
            };
            foreach (int i in x)
            {
                try
                {
                    Console.WriteLine(q1.Division(q2, i));
                }
                catch (DivideByZeroException e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }