Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
multimap
//Title of this code #include <iostream> #include <algorithm> #include <map> #include <iterator> #include <utility> #include <cstdlib> #include <iomanip> using namespace std; int main(){ const int sz = 10; multimap<int, double>mm; // mm.insert(make_pair(key, value)); // mm.insert(make_pair(1, 0.50)); mm.insert(make_pair(2, 6.12)); mm.insert(make_pair(3, 2.00)); mm.insert(make_pair(2, 7.21)); mm.insert(make_pair(4, 8.30)); mm.insert(make_pair(6, 6.12)); mm.insert(make_pair(3, 2.00)); mm.insert(make_pair(5, 10.01)); mm.insert(make_pair(7, 9.00)); cout << "Is mm empty?\t"; bool ans = mm.empty(); if(ans == true) cout << "mm is empty\n\n"; else cout << "mm is not empty\n\n"; // 'count' counts the number of occurrances of key_val // int key_val = 3; cout << "The number of " << key_val << "'s are " << mm.count(key_val) << endl; multimap<int, double>::const_iterator mSearch; cout << "\nKey\tValue\n\n"; for(int i = 1; i<(mm.size()-1); i++){ mSearch = mm.find(i); cout << showpoint << setprecision(3) << "[" << mSearch->first << "\t" << mSearch->second << "]\n"; } return 0; };
run
|
edit
|
history
|
help
0
VirtualRestoPoint
in shorted array print without duplicate o/p array
Dijkstra
algortym A*
NamespaceId
articulation points (http://codeforces.com/contest/732/problem/F)
Hello world.c
N Queens problem
12hours Clock c++
CPP - Arrays - Ex.4