-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMap.cpp
More file actions
37 lines (30 loc) · 693 Bytes
/
Copy pathMap.cpp
File metadata and controls
37 lines (30 loc) · 693 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
#include <iostream>
#include <map>
using namespace std;
int main()
{
map<int, string> m;
m[1] = "subham";
m[13] = "kumar";
m[2] = "paul";
m.insert({5, "bheem"});
cout << "before erase" << endl;
for (auto i : m)
{
cout << i.first << " " << i.second << endl;
}
cout << "finding -13 -> " << m.count(-13) << endl;
// m.erase(13);
cout << "after erase" << endl;
for (auto i : m)
{
cout << i.first << " " << i.second << endl;
}
cout << endl
<< endl;
auto it = m.find(5);
for (auto i = it; i != m.end(); i++)
{
cout << (*i).first << endl;
}
}