1个回答
展开全部
呵呵
你很幸运!我正好有个现成的。
namespace CeshiFushu
{
class Program
{
static void Main(string[] args)
{
Fushu fs1 = new Fushu(5, 3);
Fushu fs2 = new Fushu(7, 4);
Fushu fs3 = fs1 + fs2;
Console.WriteLine("实部的值是:{0}", fs3.shibu);
Console.WriteLine("虚部的值是:{0}", fs3.xubu);
Console.ReadLine();
}
}
class Fushu
{
public int shibu;//复数的实部
public int xubu;//复数的虚部
public Fushu(int a, int b)
{
this.shibu = a;
this.xubu = b;
}
public static Fushu operator +(Fushu FS1, Fushu FS2)
{
return new Fushu(FS1.shibu + FS2.shibu, FS1.xubu + FS2.xubu);
}
}
}
你很幸运!我正好有个现成的。
namespace CeshiFushu
{
class Program
{
static void Main(string[] args)
{
Fushu fs1 = new Fushu(5, 3);
Fushu fs2 = new Fushu(7, 4);
Fushu fs3 = fs1 + fs2;
Console.WriteLine("实部的值是:{0}", fs3.shibu);
Console.WriteLine("虚部的值是:{0}", fs3.xubu);
Console.ReadLine();
}
}
class Fushu
{
public int shibu;//复数的实部
public int xubu;//复数的虚部
public Fushu(int a, int b)
{
this.shibu = a;
this.xubu = b;
}
public static Fushu operator +(Fushu FS1, Fushu FS2)
{
return new Fushu(FS1.shibu + FS2.shibu, FS1.xubu + FS2.xubu);
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询