//输入年月日,判断是否正确 Console.WriteLine("输入一个年份"); int year = int.Parse(Console.ReadLine()); Console.WriteLine("输入一个月份"); int month = int.Parse(Console.ReadLine()); Console.WriteLine("输入一个日期"); int date = int.Parse(Console.ReadLine()); if (year >= 0 && year <= 9999) { Console.WriteLine(year+"年"); if (month >= 1 && month <= 12) { Console.WriteLine(month+"月"); if(month==1||month==3||month==5||month==7||month==8||month==10||month==12) { if(date>=1&&date<=31) { Console.WriteLine(+date+"号"); } else { Console.WriteLine("您输入的日期有误"); } } else if(month==4||month==6||month==9||month==11) { if(date>=1&&date<=30) { Console.WriteLine(+date+"号"); } else { Console.WriteLine("您输入的日期有误"); } } else { if(year % 4 == 0 && year % 100 != 0 || year % 400 == 0) { if(date>=1&&date<=29) { Console.WriteLine(+date+"号"); } else { Console.WriteLine("您输入的日期有误"); } } else { if(date>=1&&date<=28) { Console.WriteLine(+date+"号"); } else { Console.WriteLine("您输入的日期有误"); } } } } else { Console.WriteLine("您输入的月份有误"); } } else { Console.WriteLine("您输入的年份有误"); } Console.ReadLine();