예제 #1
0
파일: Program.cs 프로젝트: sjyfok/cpp
        static void Main(string[] args)
        {
            complex s1, s2;
            string  strinput = Console.ReadLine();

            string [] str_c = new string[2];
            str_c    = strinput.Split(' ');
            s1.r     = double.Parse(str_c[0]);
            s1.i     = double.Parse(str_c[1]);
            strinput = Console.ReadLine();
            str_c    = strinput.Split(' ');
            s2.r     = double.Parse(str_c[0]);
            s2.i     = double.Parse(str_c[1]);

            complex s3 = s1.AddComplex(s2);

            s1.Show();
            Console.Write("+");
            s2.Show();
            Console.Write("=");
            s3.Show();
            s3 = s1.SubComplex(s2);
            s1.Show();
            Console.Write('-');
            s2.Show();
            Console.Write('=');
            s3.Show();
            s3 = s1.MulComplex(s2);
            s1.Show();
            Console.Write("*");
            s2.Show();
            Console.Write("=");
            s3.Show();
            s3 = s1.DivComplex(s2);
            s1.Show();
            Console.Write("/");
            s2.Show();
            Console.Write("=");
            s3.Show();
        }