-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap2.cpp
More file actions
41 lines (33 loc) · 698 Bytes
/
Copy pathmap2.cpp
File metadata and controls
41 lines (33 loc) · 698 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
//
// main.cpp
// map2
//
// Created by Silly on 14-3-2.
// Copyright (c) 2014年 Silly. All rights reserved.
//
#include <iostream>
#include <string>
#include <map>
using namespace std;
struct myComp{
bool operator() (const int &a, const int &b){
if (a != b)
return a > b;
else
return a > b;
}
};
int main(int argc, const char * argv[])
{
map<int, char, myComp> m;
m[25] = 'm';
m[28] = 'k';
m[10] = 'x';
m[30] = 'a';
// m.erase(28);
map<int, char, myComp>::iterator it;
for (it = m.begin(); it != m.end(); it++) {
cout << (*it).first << " : " << (*it).second << endl;
}
return 0;
}