题解 | #判断季节#
判断季节
https://www.nowcoder.com/practice/741a9b79fabe474cb153a49b4bff5828
#include <iostream>
#include <string>
using namespace std;
int main() {
int month;
string result;
cin >> month;
if(month>12||month<1){
cout<<"不合法"<<endl;
return 0;
}
else {
result=month<3?"冬季":(month<6?"春季":(month<9?"夏季":(month<12?"秋季":"冬季")));
cout<<result<<endl;
return 0;
}
// write your code here......
return 0;
}
查看20道真题和解析
