Mega Code Archive
Categories
/
C++
/
Data Structure
Cycle through a map in reverse
#include
#include
using namespace std; int main() { map
mapObject; int i; for(i = 0; i <26; i++) mapObject.insert(pair
('A' + i, 65 + i)); map
::reverse_iterator p; for(p = mapObject.rbegin(); p != mapObject.rend(); p++) { cout << p->first << " has ASCII value of "; cout << p->second << endl; } return 0; }