马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
代码:
#include <iostream>
using namespace std;
int main() {
int y, m, r;
bool a;
cin >> y >> m;
a = ((!(y % 4) && (y % 100))) || !(y % 400);
switch (m) {
case 1: r = 31; break;
case 2: r = a ? 29 : 28; break;
case 3: r = 31; break;
case 4: r = 30; break;
case 5: r = 31; break;
case 6: r = 30; break;
case 7: r = 31; break;
case 8: r = 31; break;
case 9: r = 30; break;
case 10: r = 31; break;
case 11: r = 30; break;
case 12: r = 31; break;
default: r = 0; break;
}
cout << r;
return 0;
}
运行结果:
|