示例#1
0
 public static Polinom Multiplication(Polinom FirstPolinom, Polinom SecondPolinom, Polinom ThirdPolinom)
 {
     for (int i = 0; i < FirstPolinom.Count; i++)
     {
         for (int j = 0; j < SecondPolinom.Count; j++)
         {
             Element element = new Element(FirstPolinom.polinom[i].exponent + SecondPolinom.polinom[j].exponent, FirstPolinom.polinom[i].coefficient * SecondPolinom.polinom[j].coefficient);
             ThirdPolinom.Add(element);
         }
     }
     return(ThirdPolinom);
 }
示例#2
0
        public static Polinom PolinomInput(Polinom polinom1, string path)
        {
            string[] data1 = File.ReadAllLines(path);
            int      help1;
            double   help2;

            for (int i = 0; i < data1.Length; i++)
            {
                string[] helper = data1[i].Split(' ');
                if (int.TryParse(helper[0], out help1) && double.TryParse(helper[1], out help2))
                {
                    Element element = new Element(help1, help2);
                    polinom1.Add(element);
                }
            }
            return(polinom1);
        }