示例#1
0
 static void Main(string[] args)
 {
     while (true)
     {
         Console.Write("Please enter the type of shape (Circle / Square / Quit): ");
         string strInput = Console.ReadLine();
         if (strInput.ToLower() == "circle")
         {
             Circle circle1 = new Circle();
             circle1.PrintAreaOrDimension();
         }
         else if (strInput.ToLower() == "square")
         {
             Square square1 = new Square();
             square1.PrintAreaOrDimension();
         }
         else if (strInput.ToLower() == "quit")
         {
             Console.WriteLine("Bye Bye");
             break;
         }
         else
         {
             Console.WriteLine("Please enter a valid option.");
         }
     }
 }
示例#2
0
        static void Main(string[] args)
        {
            //Console.WriteLine(Variable.Count++);
            //Console.WriteLine(Variable.Count++);
            //Console.WriteLine(Variable.Count++);

            //Variable objVar1 = new Variable();
            //objVar1.Test = "Hello";
            //Console.WriteLine(objVar1.Test);

            //Variable objVar2 = new Variable();
            //Console.WriteLine(objVar2.Test);

            //objVar2.DemoMethod();
            //objVar2.DemoMethod2();
            string shape;

            while (true)
            {

                Console.Write("Please enter the type of shape (Circle/Square/Quit): ");
                shape = Console.ReadLine().ToUpper();


                if (shape == "CIRCLE")
                {
                    Circle objcircle = new Circle();
                    objcircle.FindAreaOrDimension();
                }
                else if (shape == "QUIT")
                {
                    Console.WriteLine("Bye Bye");
                    break;
                }
                else
                    Console.WriteLine("Please enter valid input: ");
            }
        }