本文整理汇总了C#中Cylinder.Area方法的典型用法代码示例。如果您正苦于以下问题:C# Cylinder.Area方法的具体用法?C# Cylinder.Area怎么用?C# Cylinder.Area使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cylinder
的用法示例。
在下文中一共展示了Cylinder.Area方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
double r = 3.0, h = 5.0;
Shape c = new Circle(r);
Shape s = new Sphere(r);
Shape l = new Cylinder(r, h);
// Display results:
Console.WriteLine("Area of Circle = {0:F2}", c.Area());
Console.WriteLine("Area of Sphere = {0:F2}", s.Area());
Console.WriteLine("Area of Cylinder = {0:F2}", l.Area());
}
示例2: Main
public static void Main()
{
double r = 3.0, h = 5.0;
Dimensions c = new Circle(r);
Dimensions s = new Sphere(r);
Dimensions l = new Cylinder(r, h);
Console.WriteLine("Area of Circle = {0}", string.Format("{0:0.00}", c.Area()));
Console.WriteLine("Area of Sphere = {0}", string.Format("{0:0.00}", s.Area()));
Console.WriteLine("Area of Cylinder = {0}", string.Format("{0:0.00}", l.Area()));
Console.ReadLine();
}
示例3: testClass
// 类
public void testClass()
{
MyClass p1 = new MyClass();
MyClass p2 = new MyClass(6, 7);
Console.WriteLine("CoOrds #1 at {0}", p1);
Console.WriteLine("CoOrds #2 at {0}", p2);
Circle ring = new Circle(2);
Cylinder tube = new Cylinder(2, 3);
Console.WriteLine("Area of the circle = {0:F2}", ring.Area());
Console.WriteLine("Area of the cylinder = {0:F2}", tube.Area());
TimePeriod ti = new TimePeriod(3600*5);
Console.WriteLine("Setid time is {0}", ti.hours);
ShapeStatic.TestSe();
}
示例4: Main
static void Main()
{
double radius = 2.5;
double height = 3.0;
Circle ring = new Circle(radius);
Cylinder tube = new Cylinder(radius, height);
Console.WriteLine("Area of the circle = {0:F2}", ring.Area());
Console.WriteLine("Area of the cylinder = {0:F2}", tube.Area());
// Keep the console window open in debug mode.
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
}