static void Main(string[] args) { double intSalary = 5000; bool bFlag = true; Console.WriteLine("请输入张三的评点等级:"); string strLevel = Console.ReadLine(); switch (strLevel) { case "A": intSalary += 500; break; case "B": intSalary += 200; break; case "C": intSalary += 0; break; case "D": intSalary -= 200; break; case "E": intSalary -= 500; break; default: bFlag = false; Console.WriteLine("输入有误,程序退出!"); break; } if (bFlag) { Console.WriteLine("张三的工资是:" + intSalary); } Console.ReadKey(); }
标签:case,intSalary,练习,bFlag,break,switch,WriteLine,Console From: https://www.cnblogs.com/csflyw/p/18353654