Console.Write("输入年:"); int year = Convert.ToInt32(Console.ReadLine()); Console.Write("输入月:"); int month = Convert.ToInt32(Console.ReadLine()); Console.Write("输入日:"); int date = Convert.ToInt32(Console.ReadLine()); int day = 0; switch (month) { case 12: day = 30; goto case 11; case 11: day = day + 31; goto case 10; case 10: day = day + 30; goto case 9; case 9: day = day + 31; goto case 8; case 8: day = day + 31; goto case 7; case 7: day = day + 30; goto case 6; case 6: day = day + 31; goto case 5; case 5: day = day + 30; goto case 4; case 4: day = day + 31; goto case 3; case 3: if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) { day = day + 29; } else { day = day + 28; } goto case 2; case 2: day = day + 31; goto case 1; case 1: break; } Console.WriteLine("{0}年{1}月{2}日是此年中的第{3}天",year ,month,date,day); Console.ReadLine();
添加回答
举报
0/150
提交
取消