输入年号和月份,输出这一年的该月的天数。《提示:要先判断输^年份是否为国年)#include <iostream>using namespace std;int main() { int year, month, days; cout << "请输入年份和月份(用空格分隔):" << endl; cin >> year >> month; bool leap = false; // 是否为闰年标记 // 判断是否为闰年 if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) { leap = true; } switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: days = 31; break; case 4: case 6: case 9: case 11: days = 30; break; case 2: if (leap) { days = 29; } else { days = 28; } break; default: cout << "输入的月份不合法!" << endl; return 0; } cout << year << "年" << month << "月有" << days << "天。" << endl; return 0;}