static void Main(string[] args) { ComplexD c = new ComplexD(5, 5); Console.WriteLine("c^3 = {0}", c ^ 3); ComplexD[] v = new ComplexD[5]; Random r = new Random(); for (int i = 0; i < 5; i++) { v[i] = new ComplexD(r.Next(1, 10), r.Next(1, 10)); Console.WriteLine("v[{0}] = {1}", i, v[i]); } Console.WriteLine("Distanta minima : {0}", c.DistantaMinimaLa(v)); Console.ReadKey(); }
static void Main(string[] args) { Random rnd = new Random(); Complex c1 = new Complex(2.5, 3.1); Complex c2 = new Complex(4.2, 1.7); Console.WriteLine($"x = {c1}"); Console.WriteLine($"y = {c2}"); Console.WriteLine($"x + y = {c1 + c2}"); Console.WriteLine($"x - y = {c1 - c2}"); Console.WriteLine($"x * y = {c1 * c2}"); Console.WriteLine($"Forma trigonometrica :\n x={c1.trig()} \n y={c2.trig()}"); ComplexD complexd = new ComplexD(3.7, 2.8); ComplexD[] cd = new ComplexD[4]; Console.WriteLine("cd = "); for (int i = 0; i < cd.Length; i++) { cd[i] = new ComplexD(rnd.Next(0, 8), rnd.Next(0, 6)); } for (int i = 0; i < cd.Length; i++) { Console.WriteLine(cd[i] + " | "); } Console.WriteLine($"complexd = {complexd}"); int k = 2; Console.WriteLine($"cd^{k} = {c1.ridicarela(k)}"); Console.WriteLine(); Console.WriteLine($"Distanta de la {complexd} la multimea lui cd este {complexd.Distanta(cd)}"); Console.ReadKey(); }