文章
81
粉丝
0
获赞
284
访问
11.5k
#include <bits/stdc++.h>
using namespace std;
// 返回某个月的天数
int mon(int x) {
switch (x) {
case 4: return 30;
case 5: return 31;
case 6: return 30;
case 7: return 31;
case 8: return 31;
case 9: return 30;
case 10: return 31;
case 11: return 30;
case 12: return 31;
default: return 0; // 处理非法输入
}
}
// 返回星期几的名称
string week(int b) {
switch (b) {
case 1: return "Monday";
case 2: return "Tuesday";
case 3: return "Wednesday";
case 4: return "Thursday";
case 5: return "Friday";
case 6: return "Saturday";
case 0: return "Sunday";
default: return "Invalid day"; // 处理非法输入
}
}
int main() {
int m, d;
cin >> m >> d;
// 检查输入是否合法
if (m < 4 || m > 12 || d < 1 || d > 31) {
cout << "Invalid input!" << endl;
return 1;
}
...
登录后发布评论
暂无评论,来抢沙发