题解 | #查找学生信息# -map解法
查找学生信息
https://www.nowcoder.com/practice/fe8bff0750c8448081759f3ee0d86bb4
#include <bits/stdc++.h> using namespace std; struct node { string id; string name; string sex; int age; }; int main() { int n; cin >> n; map<string, node> m; while (n--) { node temp; cin >> temp.id >> temp.name >> temp.sex >> temp.age; m[temp.id] = temp; } int k; cin >> k; while (k--) { string id; cin >> id; auto it = m.find(id); if (it != m.end()) { cout << m[id].id << " " << m[id].name << " " << m[id].sex << " " << m[id].age << endl; } else { cout << "No Answer!" << endl; } } }