文章
2
粉丝
93
获赞
0
访问
1.0k
#include<iostream>
using namespace std;
struct date {
int year;
int month;
int day;
};
int main() {
struct date d;
int f[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
while (cin >> d.year >> d.month >> d.day) {
if (d.month <= 0 || d.month > 12) {
cout << "Input error!" << endl; continue;
}
if (d.day <= 0 || d.day > 31) {
cout << "Input error!" << endl; continue;
}
if (d.year % 100 != 0 && d.year % 4 == 0 || d.year % 400 == 0) {
&nb...
登录后发布评论
闰年判断的优先级不太对