Example #1
0
        private void pbMul_Click(object sender, EventArgs e)
        {
            if (p1 == null || p2 == null)
            {
                return;
            }

            Polynom result = p1 * p2;

            lbResultPolynom.Text = result.ToString();
        }
Example #2
0
        /// <summary>
        /// Entry point.
        /// </summary>
        public static void Main()
        {
            Polynom x1  = new Polynom();
            Polynom x2  = new Polynom();
            Polynom x3  = x1 * x2;
            string  str = x3.ToString();

            for (int i = 0; i < x3.ArrayOfFactors.Length; i++)
            {
                Console.Write($"{x3.ArrayOfFactors[i]} ");
            }

            Console.WriteLine();
            Console.WriteLine(str);
            Console.ReadKey();
        }
Example #3
0
        private void pbNewPolynom_Click(object sender, EventArgs e)
        {
            Label destination = null;

            if (sender.Equals(pbNewPolynom1))
            {
                destination = lbPolynom1;
            }
            if (sender.Equals(pbNewPolynom2))
            {
                destination = lbPolynom2;
            }

            if (destination == null)
            {
                return;
            }

            List <double> coeficents = new List <double>();
            int           count      = 0;
            string        str;

            do
            {
                str = Interaction.InputBox(string.Format("Введите коэфицент a{0}", count++), "Коефицент");
                if (str != "")
                {
                    coeficents.Add(double.Parse(str));
                }
            } while (str != "");

            Polynom polynom = new Polynom(coeficents.ToArray());

            if (sender.Equals(pbNewPolynom1))
            {
                lbVariableName.Text = string.Format(variableNamePatern, polynom.Variable);
                p1 = polynom;
            }
            if (sender.Equals(pbNewPolynom2))
            {
                p2 = polynom;
            }

            destination.Text = polynom.ToString();
        }