#include <iostream>
#include <cstdio>
#include <map>
using namespace std;
int main(){
int n;
while(scanf("%d",&n) != EOF){
map<string,string> student;
getchar();//吃掉回车
while(n--){
string str;
getline(cin,str);
string key = str.substr(0,str.find(' '));
student[key] = str;
}
int m;
scanf("%d",&m);
while(m--){
string str2;
cin >> str2;
cout << student[str2]<<endl;
}
}
return 0;
}
查找学生信息 map使用
最新推荐文章于 2022-04-06 14:14:40 发布
博客围绕使用map查找学生信息展开,在信息技术领域,map是一种重要的数据结构,可高效存储和查找数据,通过它能快速定位学生信息,提高信息检索效率。

273

被折叠的 条评论
为什么被折叠?



