Directory Listing | |
---|---|
map.cpp
|
|
multimap.cpp
|
|
multiset.cpp
|
|
set.cpp
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main() {
multimap<int, int> obj;
multimap<int, int>::iterator it;
obj.insert(make_pair(1, 2));
obj.insert(make_pair(2, 4));
obj.insert(make_pair(2, 3));
obj.insert(make_pair(3, 1));
obj.insert(make_pair(4, 1));
obj.insert(make_pair(4, 7));
obj.insert(make_pair(8, 8));
for (it = obj.begin(); it != obj.end(); it++)
cout << it->first << " -> " << it->second << endl;
/* There is no operator[] in multimaps */
}