解题思路:
首先,先建变量N,储存数量,再建字符串数组namelist储存名单,输入N,再用for循环输入数据,最后只需要用for循环轮流判断是否相等,根据判断输出.
注意事项:
string类的使用
参考代码:
#include<iostream>
using namespace std;
int main() {
int N;
cin>>N;
string namelist[N];
for(int i=0; i<N; ++i) cin>>namelist[i];
for(int i=0; i<N; ++i) {
if(namelist[i]=="WYS") cout<<"KXZSMR\n";
else if(namelist[i]=="CQ") cout<<"CHAIQIANG\n";
else if(namelist[i]=="LC") cout<<"DRAGONNET\n";
else if(namelist[i]=="SYT" || namelist[i]=="SSD" || namelist[i]=="LSS" || namelist[i]=="LYF") cout<<"STUDYFATHER\n";
else cout<<"DENOMINATOR\n";
}
return 0;
}
0.0分
12 人评分
【回文数(二)】 (C语言代码)浏览:851 |
C语言程序设计教程(第三版)课后习题6.4 (C语言代码)浏览:592 |
C语言程序设计教程(第三版)课后习题9.8 (Java代码)浏览:1636 |
剪刀石头布 (C语言代码)不知道怎么直接在scanf中用枚举变量浏览:1307 |
打水问题 (C语言代码)浏览:1070 |
母牛的故事 (C语言代码)浏览:916 |
简单的a+b (C语言代码)浏览:681 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:519 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:676 |
C语言程序设计教程(第三版)课后习题7.3 (C语言代码)浏览:1195 |