Beispiel #1
0
        private static void Main()
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;
            Console.InputEncoding  = System.Text.Encoding.UTF8;

            MyComplex A = new MyComplex(1, 1), B = new MyComplex(), C = new MyComplex(1), D = new MyComplex();

            Console.WriteLine("Комплексне число B:");
            B.InputFromTerminal();
            Console.WriteLine($"Re(B) = {B["realValue"]}, Im(B) = {B["imageValue"]}");

            Console.WriteLine("Комплексне число D:");
            D.InputFromTerminal();
            Console.WriteLine($"Re(D) = {D["realValue"]}, Im(D) = {D["imageValue"]}");

            Console.WriteLine($"\nA = {A}, B = {B}, C = {C}, D = {D}");
            C = A + B;
            Console.WriteLine($"C = A + B = {A} + {B} = {C}");
            C = A + 10.5;
            Console.WriteLine($"C = A + 10.5 = {A} + 10.5 = {C}");
            C = 10.5 + A;
            Console.WriteLine($"C = 10.5 + A = 10.5 + {A} = {C}");
            D = -C;
            Console.WriteLine($"D = -C = -({C}) = {D}");
            Console.Write($"C = A + B + C + D = {A} + {B} + {C} + ({D}) = ");
            C = A + B + C + D;
            Console.WriteLine(C);
            C = A = B = C;
            Console.WriteLine($"C = A = B = C = {C}");
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.Unicode;
            Console.InputEncoding  = Encoding.Unicode;

            MyComplex a = new MyComplex(1, 1);
            MyComplex b = new MyComplex();
            MyComplex c = new MyComplex(1);
            MyComplex d = new MyComplex();

            Console.WriteLine("Введіть число D:");
            d.InputFromTerminal();
            Console.WriteLine();

            c = a + d;
            Console.WriteLine($"А + D = {c.ToString()}");

            c = a + 10.5;
            Console.WriteLine($"А + 10.5 = {c.ToString()}");

            c = 10.5 + a;
            Console.WriteLine($"10.5 + А  = {c.ToString()}");

            d = -c;
            Console.WriteLine($"-C = {d.ToString()}");

            c = a + b + c + d;
            Console.WriteLine($"A + B + C + D = {c.ToString()}");

            c = a * b;
            Console.WriteLine($"А * B = {c.ToString()}");

            c = 10.5 * a;
            Console.WriteLine($"А * 10.5 = {c.ToString()}");

            Console.WriteLine();
            Console.WriteLine($"A = {a.ToString()}");
            Console.WriteLine($"B = {b.ToString()}");
            Console.WriteLine($"C = {c.ToString()}");
            Console.WriteLine($"D = {d.ToString()}");

            Console.ReadKey();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.Unicode;
            Console.InputEncoding  = Encoding.Unicode;

            MyComplex A = new MyComplex(1, 1);
            MyComplex B = new MyComplex();
            MyComplex C = new MyComplex(1);
            MyComplex D = new MyComplex();

            Console.WriteLine($"A = {A}, B = {B}, C = {C}, D = {D}");

            C = A + B;
            Console.WriteLine($"\nC = A + B => \t\t C = {C}");

            C = A + 10.5;
            Console.WriteLine($"C = A + 10.5 => \t C = {C}");

            C = 10.5 + A;
            Console.WriteLine($"C = 10.5 + A => \t C = {C}");

            D = -C;
            Console.WriteLine($"D = -C => \t\t D = {D}");

            C = A + B + C + D;
            Console.WriteLine($"C = A + B + C + D => \t C = {C}");

            C = A = B = C;

            Console.WriteLine($"C = A = B = C => \t A = {A}, B = {B}, C = {C}");

            D.InputFromTerminal();

            Console.WriteLine($"\nA = {A}, B = {B}, C = {C}, D = {D}");

            Console.WriteLine();
            Console.WriteLine($"Re(A) = {A["realValue"]}, Im(A) = {A["imageValue"]}");
            Console.WriteLine($"Re(B) = {B["realValue"]}, Im(B) = {B["imageValue"]}");
            Console.WriteLine($"Re(C) = {C["realValue"]}, Im(C) = {C["imageValue"]}");
            Console.WriteLine($"Re(D) = {D["realValue"]}, Im(D) = {D["imageValue"]}");
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            MyComplex A = new MyComplex(1, 1);
            MyComplex B = new MyComplex();
            MyComplex C = new MyComplex(1);
            MyComplex D = new MyComplex();

            C = A + B;
            C = A + 10.5;
            C = 10.5 + A;
            D = -C;
            C = A + B + C + D;
            C = A = B = C;

            D.InputFromTerminal();

            Console.WriteLine($"A = {A}, B = {B}, C = {C}, D = {D}");

            Console.WriteLine($"Re(A) = {A["realPart"]}, Im(A) = {A["imaginaryPart"]}");
            Console.WriteLine($"Re(B) = {B["realPart"]}, Im(B) = {B["imaginaryPart"]}");
            Console.WriteLine($"Re(C) = {C["realPart"]}, Im(C) = {C["imaginaryPart"]}");
            Console.WriteLine($"Re(D) = {D["realPart"]}, Im(D) = {D["imaginaryPart"]}");
        }