本文整理汇总了C#中ComplexNumber.Subtract方法的典型用法代码示例。如果您正苦于以下问题:C# ComplexNumber.Subtract方法的具体用法?C# ComplexNumber.Subtract怎么用?C# ComplexNumber.Subtract使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ComplexNumber
的用法示例。
在下文中一共展示了ComplexNumber.Subtract方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Simple1
public void Simple1()
{
var complexNumber1 = new ComplexNumber(4, 3);
var complexNumber2 = new ComplexNumber(6, 2);
var complexNumber3 = new ComplexNumber(-2, -4);
var complexNumber4 = new ComplexNumber(3, -8);
var complexNumber5 = new ComplexNumber(8, 3);
var resultComplexNumber = complexNumber1.Subtract(complexNumber2);
Assert.AreEqual(1, resultComplexNumber.Imaginary);
Assert.AreEqual(-2, resultComplexNumber.Real);
resultComplexNumber = complexNumber1.Subtract(complexNumber3);
Assert.AreEqual(7, resultComplexNumber.Imaginary);
Assert.AreEqual(6, resultComplexNumber.Real);
resultComplexNumber = complexNumber1.Subtract(complexNumber4);
Assert.AreEqual(11, resultComplexNumber.Imaginary);
Assert.AreEqual(1, resultComplexNumber.Real);
resultComplexNumber = complexNumber1.Subtract(complexNumber5);
Assert.AreEqual(0, resultComplexNumber.Imaginary);
Assert.AreEqual(-4, resultComplexNumber.Real);
}
示例2: SubtractExample
public void SubtractExample()
{
var complexNumber1 = new ComplexNumber(4, 3);
var complexNumber2 = new ComplexNumber(6, 2);
var result = complexNumber1.Subtract(complexNumber2);
Assert.AreEqual(result.Imaginary, 1);
Assert.AreEqual(result.Real, -2);
}