class Program
{
static void Main(string[] args)
{
int dayNum = -1;
Console.WriteLine("输入一个数字:");
try
{
dayNum = Convert.ToInt32(Console.ReadLine());
}
catch (FormatException ex)
{
Console.WriteLine(ex.Message);
Console.ReadKey();
return;
}
switch (dayNum)
{
case 1:
Console.WriteLine("星期一");
break;
case 2:
Console.WriteLine("星期二");
break;
case 3:
Console.WriteLine("星期三");
break;
case 4:
Console.WriteLine("星期四");
break;
case 5:
Console.WriteLine("星期五");
break;
case 6:
Console.WriteLine("星期六");
break;
case 7:
Console.WriteLine("星期日");
break;
default:
Console.WriteLine("输入的数字有误!");
break;
}
Console.ReadKey();
}
}