题解 | #HTTP状态码#

知识点:

分支控制:分支控制

数据类型:map<int, string>

#include <iostream>
#include <map>
using namespace std;

int main() {
    int code = 0;
    map<int, string> state = {
        {200, "OK"},
        {202, "Accepted"},
        {400, "Bad Request"},
        {403, "Forbidden"},
        {404, "Not Found"},
        {500, "Internal Server Error"},
        {502, "Bad Gateway"}
    };

    while (cin >> code) {
        cout << state[code] << endl;
    }

    return 0;
}


#算法#
全部评论

相关推荐

野猪不是猪🐗:还是太卑微了,什么叫放弃本次面试应该说经过评估,贵公司与自己不匹配,决定不再推进后续流程
点赞 评论 收藏
分享
评论
1
1
分享

创作者周榜

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