题解 | #判断季节#

判断季节

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

#include <iostream>
using namespace std;

int main() {

    int month;
    cin >> month;

    // write your code here......
    switch (month) {
        case 3:
        case 4:
        case 5:
            cout << "春季" << endl;
            break;

        case 6:
        case 7:
        case 8:
            cout << "夏季" << endl;
            break;

        case 9:
        case 10:
        case 11:
            cout << "秋季" << endl;
            break;

        case 12:
        case 1:
        case 2:
            cout << "冬季" << endl;
            break;

        default:
            cout << "不合法" << endl;
            break;
    }

    return 0;
}

全部评论

相关推荐

11-03 14:38
重庆大学 Java
AAA求offer教程:我手都抬起来了又揣裤兜了
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务