为什么我错了,哪位大佬帮忙看看?

lyh098 仙辞 2023-12-15 19:05:34 9

#include <bits/stdc++.h>

using namespace std;

int rn(int n) { if (n % 4 == 0) { if (n % 100 == 0) { if (n % 400 == 0) { return 1; } else return 0; } else return 1; } else return 0; } #include <bits/stdc++.h>

using namespace std; #include <bits/stdc++.h>

using namespace std;

int rn(int n) { if (n % 4 == 0) { if (n % 100 == 0) { if (n % 400 == 0) { return 1; } else return 0; } else return 1; } else return 0; } int main() { int n, m; cin >> n >> m; if (rn(n) == 0) { switch (m) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: cout << "31"; break; case 4: case 6: case 9: case 11: cout << "30"; break; case 2: cout << "28"; break; } } else { switch (m) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: cout << "31"; break; case 4: case 6: case 9: case 11: cout << "30"; break; case 2: cout << "29"; break; } } return 0; } v int rn(int n) { if (n % 4 == 0) { if (n % 100 == 0) { if (n % 400 == 0) { return 1; } else return 0; } else return 1; } else return 0; } int main() { int n, m; cin >> n >> m; if (rn(n) == 0) { switch (m) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: cout << "31"; break; case 4: case 6: case 9: case 11: cout << "30"; break; case 2: cout << "28"; break; } } else { switch (m) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: cout << "31"; break; case 4: case 6: case 9: case 11: cout << "30"; break; case 2: cout << "29"; break; } } return 0; { int n, m; cin >> n >> m; if (rn(n) == 0) { switch (m) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: cout << "31"; break; case 4: case 6: case 9: case 11: cout << "30"; break; case 2: cout << "28"; break; } } else { switch (m) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: cout << "31"; break; case 4: case 6: case 9: case 11: cout << "30"; break; case 2: cout << "29"; break; } } return 0; }

{{ vote && vote.total.up }}

共 12 条回复

root 站长

你重新写一遍,有问题再贴代码来问我

lyh198 波风水门

yes

lyh098 仙辞

????????

root 站长

我看到了好几个 #include .......

root 站长

包含了太多的重复代码

lyh098 仙辞
lyh098 仙辞
lyh098 仙辞
lyh098 仙辞
lyh098 仙辞