本文整理汇总了C#中Square.Area方法的典型用法代码示例。如果您正苦于以下问题:C# Square.Area方法的具体用法?C# Square.Area怎么用?C# Square.Area使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Square
的用法示例。
在下文中一共展示了Square.Area方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main()
{
double x = 5.2;
Square s = new Square(x);
Square c = new Cube(x);
Console.WriteLine("Area of Square = {0:F2}", s.Area());
Console.WriteLine("Area of Cube = {0:F2}", c.Area());
}
示例2: Main
public static void Main()
{
double x = 5.2;
Square s = new Square(x);
Square c = new Cube(x);
Console.WriteLine("Area of Square = {0}", string.Format("{0:0.00}", s.Area()));
Console.WriteLine("Area of Cube = {0}", string.Format("{0:0.00}", c.Area()));
Console.ReadLine();
}
示例3: Main
static void Main(string[] args)
{
System.Console.Write("x: ");
int x = Convert.ToInt32(System.Console.ReadLine());
System.Console.WriteLine(String.Format("4 * x * x + 3 * x – 5 = {0}", x));
System.Console.WriteLine("\nPapers:");
foreach (Paper paper in Enum.GetValues(typeof(Paper))) {
System.Console.WriteLine(paper);
}
System.Console.WriteLine("\nSquare points:\n(0, 0)\n(0, 2)\n(2, 0)\n(2, 2)");
Square square = new Square(new Point(0, 0), new Point(0, 2), new Point(2, 0), new Point(2, 2));
System.Console.WriteLine(String.Format("Its area: {0}", square.Area()));
}
示例4: Main
static void Main()
{
Square square = new Square(100);
System.Console.WriteLine(square.Area());
}
示例5: Main
static void Main()
{
Square sq = new Square(12);
Console.WriteLine("Area of the square = {0}", sq.Area());
}