本文整理汇总了C#中System.Numerics.Complex.Complex构造函数的典型用法代码示例。如果您正苦于以下问题:C# Complex构造函数的具体用法?C# Complex怎么用?C# Complex使用的例子?那么恭喜您, 这里精选的构造函数代码示例或许可以为您提供帮助。您也可以进一步了解该构造函数所在类System.Numerics.Complex
的用法示例。
在下文中一共展示了Complex构造函数的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
//引入命名空间
using System;
using System.Numerics;
public class Example
{
public static void Main()
{
Complex complex1 = new Complex(17.34, 12.87);
Complex complex2 = new Complex(8.76, 5.19);
Console.WriteLine("{0} + {1} = {2}", complex1, complex2,
complex1 + complex2);
Console.WriteLine("{0} - {1} = {2}", complex1, complex2,
complex1 - complex2);
Console.WriteLine("{0} * {1} = {2}", complex1, complex2,
complex1 * complex2);
Console.WriteLine("{0} / {1} = {2}", complex1, complex2,
complex1 / complex2);
}
}
输出:
(17.34, 12.87) + (8.76, 5.19) = (26.1, 18.06) (17.34, 12.87) - (8.76, 5.19) = (8.58, 7.68) (17.34, 12.87) * (8.76, 5.19) = (85.1031, 202.7358) (17.34, 12.87) / (8.76, 5.19) = (2.10944241403558, 0.219405693054265)