c# 问题 注释怎么写using System;using System.Collections.Generic;usi
c# 问题 注释怎么写
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ComplexNumber x, y;
Console.Write("Enter the real part of complex number x:");
double realPart = Convert.ToDouble(Console.ReadLine());
Console.Write("Enter the real part of complex number x:");
double imaginaryPart = Convert.ToDouble(Console.ReadLine());
x = new ComplexNumber(realPart, imaginaryPart);
Console.Write("nEnter the real part of complex number y:");
realPart = Convert.ToDouble(Console.ReadLine());
Console.Write("Enter the imaginary part of complex number y:");
imaginaryPart = Convert.ToDouble(Console.ReadLine());
y = new ComplexNumber(realPart, imaginaryPart);
Console.WriteLine();
Console.WriteLine("{0}+{1}={2}", x, y, x + y);
Console.WriteLine("{0}-{1}={2}", x, y, x - y);
Console.WriteLine("{0}*{1}={2}", x, y, x * y);
}
public class ComplexNumber
{
public double Real { get;private set;}
public double Imaginary { get;private set;}
public ComplexNumber(double a, double b)
{
Real = a;
Imaginary = b;
}
public override string ToString()
{
return string.Format("({0}{1}{2}i)", Real, (Imaginary < 0 ? "-" : "+"), Math.Abs(Imaginary));
}
public static ComplexNumber operator +(ComplexNumber x, ComplexNumber y)
{
return new ComplexNumber(x.Real + y.Real, x.Imaginary + y.Imaginary);
}
public static ComplexNumber operator -(ComplexNumber x, ComplexNumber y)
{
return new ComplexNumber(x.Real - y.Real, x.Imaginary - y.Imaginary);
}
public static ComplexNumber operator *(ComplexNumber x, ComplexNumber y)
{
return new ComplexNumber(x.Real * y.Real - x.Imaginary * y.Imaginary, x.Real * y.Imaginary + y.Real * x.Imaginary);
}
}
}
}
能把注释都写出来么,谢谢