コード例 #1
0
        public static MyComplex operator /(MyComplex a, MyComplex b)
        {
            MyComplex x = new MyComplex();

            x.Re = a.Re * b.Re;
            x.Im = a.Im * b.Im;
            //x = a.Re * b.Re, a.Im * b.Im;
            return(x);
        }
コード例 #2
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();

            D.InputFromTerminal();

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

            Console.WriteLine($"\nA = {A}, B = {B}, C = {C}, D = {D}" + $"");
            Console.WriteLine(
                $"\nRe(A) = {A["Re"]}, Im(A) = {A["Im"]}\n" +
                $"Re(B) = {B["Re"]}, Im(B) = {B["Im"]}\n" +
                $"Re(C) = {C["Re"]}, Im(C) = {C["Im"]} \n" +
                $"Re(D) = {D["Re"]}, Im(D) = {D["Im"]}\n");
        }