using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace zzzzz
{
class Program
{
static void Main(string[] args)
{
double a, b, c, d;
Console.Write("请输入第一个复数的实数部:");
a = Convert.ToDouble(Console.ReadLine());
Console.Write("请输入第一个数的虚数部:");
c = Convert.ToDouble(Console.ReadLine());
Console.Write("请输入第二个复数的实数部:");
b = Convert.ToDouble(Console.ReadLine());
Console.Write("请输入第二个数的虚数部:");
d = Convert.ToDouble(Console.ReadLine());
Complex rect1 = new Complex();
rect1.a = 1;
rect1.c = 2;
rect1.b = 3;
rect1.d = 4;
Console.WriteLine("复数相加{0}+{1}",rect1.add(),rect1.Add());
Console.WriteLine("复数相减{0}+{1}", rect1.SubStract(), rect1.substract());
Console.Read();
}
}
class Complex
{
public double a;
public double b;
public double c;
public double d;
public double add()
{
return a + b;
}
public string Add()
{
return (c + d ) + "i";
}
public double SubStract()
{
return a-b;
}
public string substract()
{
return (c - d) + "i";
}
}
}