通过Switch语句判断不同星期日用户需要读的书-c#编程小实例
关键代码:
static void Main(string[] args)
{
String myStr, myBook;
Console.WriteLine("请输入:星期一、星期二、星期三、星期四、星期五、星期六、星期日");
myStr = Console.ReadLine();
switch (myStr) {
case "星期一":
myBook = "《三国演义》";
break;
case "星期二":
myBook = "《网站建设》";
break;
case "星期三":
myBook = "《SEO》";
break;
case "星期四":
myBook = "《云计算》";
break;
case "星期五":
myBook = "《网络推广》";
break;
case "星期六":
myBook = "《网络营销》";
break;
case "星期日":
myBook = "《编程思想》";
break;
}
Console.WriteLine("今天是{0},您需要读的书是:{1}",myStr,myBook);
Console.ReadKey();
}