public static complex pow(complex x, int n) { double newp = Math.Pow(x.p, n); double newfi = n * x.fi; complex newc = new complex(newp, newfi); newc.toAlg(); return(newc); }
public static complex operator /(complex x, complex y) { double newp, newfi; newp = x.p / y.p; newfi = x.fi - y.fi; complex newc = new complex(newp, newfi); newc.toAlg(); return(newc); }
public static complex operator -(complex x, complex y) { double newa, newb; newa = x.a - y.a; newb = x.b - y.b; complex newc = new complex(0, 0); newc.a = newa; newc.b = newb; newc.toTrig(); return(newc); }
static void Main(string[] args) { complex a, b, c, d; double p, fi; Console.WriteLine("Введите p числа а:"); p = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Введите fi числа а:"); fi = Convert.ToDouble(Console.ReadLine()); a = new complex(p, fi); Console.WriteLine("Введите p числа b:"); p = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Введите fi числа b:"); fi = Convert.ToDouble(Console.ReadLine()); b = new complex(p, fi); Console.WriteLine("Введите p числа c:"); p = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Введите fi числа c:"); fi = Convert.ToDouble(Console.ReadLine()); c = new complex(p, fi); Console.WriteLine("Введите p числа d:"); p = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Введите fi числа d:"); fi = Convert.ToDouble(Console.ReadLine()); d = new complex(p, fi); complex result = complex.pow(b, 3) + (a + b) / (c - a) * d; Console.WriteLine("Ответ в тригонометрической форме:"); result.printTrig(); Console.WriteLine(); Console.WriteLine("Ответ в алгебраической форме:"); result.printAlg(); Console.WriteLine(); Console.WriteLine("end"); Console.ReadKey(); }