当前位置: 首页>>代码示例>>C#>>正文


C# Cylinder.Area方法代码示例

本文整理汇总了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());
 }
开发者ID:terryjintry,项目名称:OLSource1,代码行数:11,代码来源:virtual--csharp-reference-_2.cs

示例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();
    }
开发者ID:Nagato23,项目名称:CsBasic,代码行数:13,代码来源:virtualTest.cs

示例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();
        }
开发者ID:howard1982,项目名称:csharp,代码行数:20,代码来源:Program.cs

示例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();
    }
开发者ID:robertmirro,项目名称:csharp-sandbox,代码行数:15,代码来源:ConstructorTest.cs


注:本文中的Cylinder.Area方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。