-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhashing.cpp
More file actions
46 lines (32 loc) · 801 Bytes
/
hashing.cpp
File metadata and controls
46 lines (32 loc) · 801 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
#include <stdio.h>
#include <unordered_map>
#include <map>
using namespace std;
int main()
{
// creation
unordered_map<string, int> mp;
// key-value pair storing ..for above ex. - stored in string,int form
// insertion
// 1
pair<string, int> p = make_pair("gudu", 3);
mp.insert(p);
// 2
pair<string, int> p2("enu", 3);
mp.insert(p2);
// updation of map key value pair
mp["gudu"] = 1;
mp["gudu"] = 3;
for (auto u : mp)
{
cout << u.first << " " << u.second << endl;
}
unordered_map<string, int>::iterator it = mp.begin();
while (it != mp.end())
{
cout << it->first << " " << it->second << endl;
it++;
}
return 0;
}