-
Notifications
You must be signed in to change notification settings - Fork 0
/
STLSetMap.cpp
45 lines (41 loc) · 974 Bytes
/
STLSetMap.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <iostream>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <map>
#include <vector>
using namespace std;
int main(){
/*
set<int> tree;
tree.insert(50);
tree.insert(20);
tree.insert(70);
tree.insert(10);
tree.insert(30);
tree.insert(60);
tree.insert(80);
for(auto it=tree.begin(); it!=tree.end(); it++){
cout<<*it<<endl;
}
cout << "/////////////////////" << endl;
for(int v:tree){
cout<<v<<endl;
}
return 0;
*/
map<int, vector<string>> calificaciones;
calificaciones[100].push_back("lorena");
calificaciones[70].push_back("juan");
calificaciones[85].push_back("ana");
calificaciones[100].push_back("alonso");
calificaciones[100].push_back("fernanda");
int c = 0;
for(auto it=calificaciones.rbegin(); it!=calificaciones.rend(); it++){
cout<<it->first<<":";
for(string persona:calificaciones[it->first]){
cout<<persona<<",";
}
cout<<endl;
}
}