예제 #1
0
        static void Main(string[] args)
        {
            Mnogochlen a = new Mnogochlen();
            Mnogochlen b = new Mnogochlen();

            a.vvod();
            Console.WriteLine(a);
            b.vvod();
            Console.WriteLine(b);
            Console.WriteLine("(" + a + ")*(" + b + ")=" + (a * b));
            Console.ReadKey();
        }
예제 #2
0
        public static Mnogochlen operator *(Mnogochlen a, Mnogochlen b)
        {
            Mnogochlen rez = new Mnogochlen(a.mnogochlen.Count - 1 + b.mnogochlen.Count - 1);

            for (int i = 0; i < a.mnogochlen.Count; i++)
            {
                for (int j = 0; j < b.mnogochlen.Count; j++)
                {
                    rez.mnogochlen[i + j] += a.mnogochlen[i] * b.mnogochlen[j];
                }
            }
            return(rez);
        }