-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path8maps.cpp
More file actions
32 lines (26 loc) · 777 Bytes
/
8maps.cpp
File metadata and controls
32 lines (26 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
#include <string>
#include <map>
int main() {
std::map<std::string, std::string> book;
int n;
std::cin >> n;
std::cin.ignore();
for (int i = 0; i < n; i++) {
std::string input;
std::getline(std::cin, input);
auto index {input.find(" ")};
std::string name {input.substr(0, index)};
std::string telephone {input.substr(index+1)};
book.insert(std::pair{name, telephone});
}
std::string search;
while (std::getline(std::cin, search) && !search.empty()) {
auto itr = book.find(search);
if (itr != book.end())
std::cout << itr->first << "=" << itr->second << '\n';
else
std::cout << "Not found\n";
}
return 0;
}