Esempio n. 1
0
        static Cplx Prod(Cplx A, Cplx B)
        {
            Cplx prd = new Cplx();

            prd.Re = A.Re * B.Re - A.Im * B.Im;
            prd.Im = A.Re * B.Im + B.Re * A.Im;
            return(prd);
        }
Esempio n. 2
0
        static Cplx Sum(Cplx A, Cplx B)
        {
            Cplx toR = new Cplx();

            toR.Re = A.Re + B.Re;
            toR.Im = A.Im + B.Im;
            return(toR);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Cplx A = new Cplx();

            A.Re = 4;
            A.Im = 2;
            A.View();

            Cplx B = new Cplx();

            B.Re = 1;
            B.Im = 5;
            B.View();

            Cplx C = Sum(A, B);

            C.View();

            Cplx D = Prod(A, B);

            D.View();

            Console.ReadKey();
        }