C#控制台基本使用:
enum Input { 查看列表=1, 加载数据=2, 更新数据=3, 退出程序=4 } class Program { static void Main(string[] args) { Init(); Input input = (Input)Enum.Parse(typeof(Input), Console.ReadLine()); while (input!=Input.退出程序) { switch (input) { case Input.加载数据: LoadData(); Init(); break; case Input.更新数据: UpdateData(); Init(); break; case Input.查看列表: ShowList(); Init(); break; default: Console.WriteLine("Input ERROR:"); Init(); break; } input = (Input)Enum.Parse(typeof(Input), Console.ReadLine()); } } private static void ShowList() { Console.Clear(); for (int i = 0; i <= 10; i++) { Console.WriteLine($"{i}*{i+1}={i*(i+1)}"); Thread.Sleep(1000); } } private static void UpdateData() { for (int i = 0; i <= 10; i++) { Console.Clear(); Console.WriteLine("更新数据"); string s= GetString(i); Console.WriteLine(s); Thread.Sleep(1000); } } private static string GetString(int i) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < i; j++) { sb.Append("=="); } sb.Append($"> {i}/10"); return sb.ToString(); } private static void LoadData() { throw new NotImplementedException(); } private static void Init() { Console.WriteLine("Please enter the following numbers!!!"); Console.WriteLine("1.Show List."); Console.WriteLine("2.Load Data."); Console.WriteLine("3.Update Data."); Console.WriteLine("4.Exit."); } }