//作者:B15崔福晋
//班级:软件技术二班
//完成日期:2014年12月11日
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{double a, b, c, d;
Console.WriteLine("请输入第一个复数实部的值:");
a = Convert.ToDouble(Console .ReadLine ());
Console.WriteLine("请输入第一个复数虚部的值:");
b = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("请输入第二个复数实部的值:");
c = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("请输入第二个复数虚部的值:");
d = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("两个复数相加的和为:{0}+{1}i", Complex.j(a, c), Complex.i(b, d));
Console.WriteLine("两个复数相减的和为:{0}+{1}i", Complex.z(a, c), Complex.y(b, d));
Console.ReadKey();
}
}
class Complex
{
static public double j(double a, double c)
{
return a + c;
}
static public double i(double b, double d)
{
return b + d;
}
static public double z(double a, double c)
{
return a - c;
}
static public double y(double b, double d)
{
return b - d;
}
}
}