1#include<map>
2
3int main(){
4
5 map<int,char> m;
6
7 char ch = '!';
8
9 if (m.find(ch) != m.end()) {
10 std::cout << "Key found";
11 } else {
12 std::cout << "Key not found";
13 }
14
15 return 0;
16}
1#include <iostream>
2#include <unordered_map>
3#include <algorithm>
4
5int main()
6{
7 std::unordered_map<char,int> m;
8
9 std::string s("abcba");
10 std::for_each(s.begin(), s.end(), [&m](char &c) { m[c]++; });
11
12 char ch = 's';
13
14 if (m.find(ch) != m.end()) {
15 std::cout << "Key found";
16 } else {
17 std::cout << "Key not found";
18 }
19
20 return 0;
21}
22