通过if语句判断每周某天早餐吃什么东西?-c#编程小实例

济南网站建设 2022年10月8日10:10:39C#教程通过if语句判断每周某天早餐吃什么东西?-c#编程小实例已关闭评论119阅读模式

关键代码:
internal class Program
{
static void Main(string[] args)
{

int a= 6;
if (a ==1) {

Console.WriteLine("今天是星期一,早餐吃包子!");

}
else if (a == 2)
{

Console.WriteLine("今天是星期二,早餐吃花卷!");

}
else if(a == 3)
{

Console.WriteLine("今天是星期三,早餐吃米饭!");

}
else if (a == 4)
{

Console.WriteLine("今天是星期四,早餐吃油条!");

}
else if (a == 5)
{

Console.WriteLine("今天是星期五,早餐吃油饼!");

}
else if (a == 6)
{

Console.WriteLine("今天是周六,早餐吃水饺!");

}
else if (a == 7)
{

Console.WriteLine("今天是周日,早餐吃面条!");

}
else { Console.WriteLine("您输入的数据格式,存在错误!"); }

 

 

Console.ReadKey();

}
}

济南网站建设
  • 本文由 发表于 2022年10月8日10:10:39
  • 转载请务必保留本文链接:http://news.hcsw666.com/343