예제 #1
0
        static void Main(string[] args)
        {
            ICalculate calculate = new ICalculate();

            int result;

            result = calculate.Add(26, 54);
            Console.WriteLine(result);

            result = calculate.Div(26, 54);
            Console.WriteLine(result);

            result = calculate.Sub(26, 54);
            Console.WriteLine(result);

            result = calculate.Div(26, 54);

            Console.WriteLine(result);
        }
예제 #2
0
        public static Polynom <T> operator /(Polynom <T> A, Polynom <T> B)
        {
            if (A == null || B == null)
            {
                return(null);
            }
            var         res = new Polynom <T>(_calculator);
            var         num = new Polynom <T>(A, _calculator);
            Polynom <T> tmp;

            while (num >= B)
            {
                Monom <T> newMonom;
                newMonom.pow  = num.polynom[0].pow - B.polynom[0].pow;
                newMonom.coef = _calculator.Div(num.polynom[0].coef, B.polynom[0].coef);
                res.Add(newMonom);
                tmp = B * newMonom;
                num = num - tmp;
                num.polynom.RemoveAt(0);
            }
            return(res);
        }