示例#1
0
        static void Main(string[] args)
        {
            MyRectangle rect = new MyRectangle();

            rect.Width  = 10;
            rect.Height = 10;
            Console.WriteLine("面積為" + rect.GetArea());
            Console.ReadLine();
        }
示例#2
0
文件: Program.cs 项目: Jason0952/C-
        static void Main(string[] args)
        {
            MyRectangle rectangle = new MyRectangle();

            rectangle.Width  = 10;
            rectangle.Height = 10;
            Console.WriteLine("長度:" + rectangle.Height + "\n" + "寬度:" + rectangle.Width);
            Console.WriteLine("面積為:" + rectangle.GetArea());
            Console.ReadLine();
        }
示例#3
0
        static void Main(string[] args)
        {
            MyRectangle rect = new MyRectangle(8, 4);

            Console.WriteLine(rect.GetArea());
            Console.WriteLine(rect.GetPerimeter());
            Console.WriteLine(rect.About());
            Console.WriteLine("----");
            Random
            MyVolumeRectangle vrect = new MyVolumeRectangle(2, 1, 4);

            Console.WriteLine(vrect.GetArea());
            Console.WriteLine(vrect.GetPerimeter());
            Console.WriteLine(vrect.GetVolume());
            Console.WriteLine(vrect.About());
            Console.ReadLine();
        }