关于一些程序解析
朗朗速度 2012-04-22 09:53:29 麻烦有解析下面这个程序 要详细的哦
class Program
{
static Hashtable table = new Hashtable();
static void Main(string[] args)
{
table.Add(1, "一月份January");
table.Add(2, "二月份February");
table.Add(3, "三月份March");
table.Add(4, "四月份April");
table.Add(5, "五月份May");
table.Add(6, "六月份June");
table.Add(7, "七月份July");
table.Add(8, "八月份August");
table.Add(9, "九月份September");
table.Add(10, "十月份October");
table.Add(11, "十一月份November");
table.Add(12, "十二月份December");
int month = 0;
while (true)
{
Console.WriteLine("请输入月份的数字(输入0退出):");
if (!int.TryParse(Console.ReadLine(), out month))
{
Console.WriteLine("输入错误,请重新输入。");
continue;
}
if (month == 0)
{
break;
}
else if (month > 0 && month <= 12)
{
Console.WriteLine(table[month]);
}
else
{
Console.WriteLine("输入错误");
}
}
}
}
}