static void Main(string[] args) { char opt; do { Console.WriteLine("Welcom to Rainbow School"); Console.WriteLine("1 - store a new teacher data"); Console.WriteLine("2 - retrieve teacher data"); Console.WriteLine("3 - update teacher data"); Console.WriteLine("Select Option : "); int choice = int.Parse(Console.ReadLine()); Opration opration = new Opration(); switch (choice) { case 1: opration.writeData(); Console.ReadKey(); break; ///////////// case 2: opration.retrieveData(); Console.ReadKey(); break; ///////////// case 3: opration.updateData(); Console.ReadKey(); break; default: Console.WriteLine("Invalid Choice!!"); break; } Console.Write("Do you wish to Continue?(yes/No) : "); opt = char.Parse(Console.ReadLine()); } while(opt == 'y' || opt == 'Y'); Console.Write("Thank You"); }
static void Main(string[] args) { Console.Write("请输入数字A:"); string numA = Console.ReadLine(); Console.Write("请输入运算符:"); string oparate = Console.ReadLine(); Console.Write("请输入数字B:"); string numB = Console.ReadLine(); double result = 0.0; Opration opration = Factory.CreateOprate(oparate); opration.NumberA = Convert.ToDouble(numA); opration.NumberB = Convert.ToDouble(numB); result = opration.GetResult(); Console.WriteLine("结果:" + result); Console.ReadKey(); }