题解 | #HTTP状态码#
HTTP状态码
https://www.nowcoder.com/practice/99dba043761e43c2a6f931e2c5c247c7
#include<stdio.h> int main() { int a;//定义HTTP码 while(scanf("%d\n",&a)!=EOF)//多组输入标配 { switch(a)//判断a的值 { case 200:printf("OK\n");break;//如果a等于200,就进入这个里面,遇到break跳出switch case 202:printf("Accepted\n");break; case 400:printf("Bad Request\n");break; case 403:printf("Forbidden\n");break; case 404:printf("Not Found\n");break; case 500:printf("Internal Server Error\n");break; case 502:printf("Bad Gateway\n");break; default:break;//上述都不符合,进入default,碰到break跳出switch } } return 0; }