Mega Code Archive
Categories
/
C++
/
Map Multimap
Iterating over the elements of the map and using the current pair option and second elements
#include
#include
#include
using namespace std; int main() { map
option; option["r"] = 0.1; option["s"] = 0.2; option["K"] = 1.0; option["T"] = 0.7; option["S"] = 1.3; cout << "Size of map: " << option.size() << endl;; map
::iterator i = option.begin(); while (i != option.end()) { cout << "Element pair [" << (*i).first << "," << (*i).second << "]"; i++; } return 0; }