Mega Code Archive
Categories
/
C++
/
Data Structure
Use the greater function object in Map
#include
#include
#include
#include
using namespace std; int main() { map
> mapObject; mapObject["A"] = 20; mapObject["B"] = 19; mapObject["C"] = 10; map
>::iterator p; for(p = mapObject.begin(); p != mapObject.end(); p++) { cout << p->first << " has value of "; cout << p->second << endl; } return 0; }