示例#1
0
 static void Main(string[] args)
 {
     if (args.Length == 2)
     {
         float rectangle, tri, pri, pyra, dia, squ;
         rectangle = AreaRec(float.Parse(args[0]), float.Parse(args[1]));
         tri       = triangle.AreaTri(float.Parse(args[0]), float.Parse(args[1]));
         pri       = Prism.AreaPri(float.Parse(args[0]), float.Parse(args[1]));
         pyra      = pyramid.AreaPyramid(float.Parse(args[0]), float.Parse(args[1]));
         dia       = Diamond.AreaDiamond(float.Parse(args[0]), float.Parse(args[1]));
         squ       = square.AreaSquare(float.Parse(args[0]));
         Console.WriteLine($"Square {args[0]}x{args[0]}: " + squ);
         Console.WriteLine($"Rectangle {args[0]}x{args[1]}: " + rectangle);
         Console.WriteLine($"Triangle 0.5x{args[0]}x{args[1]}: " + tri);
         Console.WriteLine($"Prism {args[0]}x{args[1]}: " + pri);
         Console.WriteLine($"Pyramid {args[0]}x{args[1]}: " + pyra);
         Console.WriteLine($"Diamond 0.3x{args[0]}x{args[1]}: " + dia);
     }
     else
     {
         Console.WriteLine("Cal Data of Geometry");
     }
 }
示例#2
0
        static void Main(string[] args)
        {
            int   select = -1;
            Prism prism  = new Prism();

            while (select != 0)
            {
                Console.WriteLine("Make a choice:");
                Console.Write("0-Exit; 1 - Show prism height; 2 - Show the number of side faces; 3 - Show squar grounds; 4 - Show side length; 5 - Show Prism volume; 6 - Set prism height; 7 - Set the length of the sides of the prism; 8 - Set the number of prism faces; 9 - Set square grounds" + "\n>>");
                select = Convert.ToInt32(Console.ReadLine());
                switch (select)
                {
                case 1:
                {
                    prism.show_prism_height();
                    break;
                }

                case 2:
                {
                    prism.number_of_side_faces();
                    break;
                }

                case 3:
                {
                    prism.show_squar_grounds();
                    break;
                }

                case 4:
                {
                    prism.show_side_length();
                    break;
                }

                case 5:
                {
                    prism.show_prism_volume();
                    break;
                }

                case 6:
                {
                    prism.set_prism_height();
                    break;
                }

                case 7:
                {
                    prism.set_side_length();
                    break;
                }

                case 8:
                {
                    prism.set_number_of_side_faces();
                    break;
                }

                case 9:
                {
                    prism.set_square_grounds();
                    break;
                }

                default: break;
                }
            }
        }