小白1-J--stl map

小白1-J--stl map_第1张图片

 

 

小白1-J--stl map_第2张图片

 

 

小白1-J--stl map_第3张图片

 

 

#include
#include
using namespace std;
int main() {
string s1;
string s2;
string s3;
string s4;
cin >> s1 >> s2 >> s4 >> s3 >> s4 >> s4;
int n;
cin >> n;
while (n--) {
string s;
cin >> s;
if (s != s1 && s != s2 && s != s3)
cout << "Fake" << endl;
else {
if (s == s2)cout << s1 << endl;
else if (s == s3)cout << s2 << endl;
else cout << s3 << endl;
}
}
}

 

 

s4用来缓存重复输入的string 然后后面每输入一次就判断和输出即可

 

下面是其他学者用stl的map值得学习

https://blog.csdn.net/memory_qianxiao/article/details/79597022

 

你可能感兴趣的:(小白1-J--stl map)