题解 | #判断季节#

判断季节

http://www.nowcoder.com/practice/741a9b79fabe474cb153a49b4bff5828

#include <iostream>
#include <string>
using namespace std;
string mo(int month){
    if (month >= 3 and month <= 5) return "春季";
    if (month >= 6 and month <= 8) return "夏季";
    if (month >= 9 and month <= 11) return "秋季";
    if ((month == 12) or (month >= 1 and month <= 2)) return "冬季";
    else return "不合法";
}
int main() {
    
    int month;
    cin >> month;

    // write your code here......
    cout << mo(month) << endl;

    return 0;
}
全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务