#include <iostream>
#include <string>
#include <map>
void printMapBackwards(std::map<char, int> mp) {
for (auto rit = mp.crbegin(); rit != mp.crend(); ++rit)
std::cout << rit->first << ": " << rit->second << '\n';
}
int main ()
{
std::map<char, int> mp;
mp['a'] = 1;
mp['x'] = 7;
mp['r'] = 9;
mp['y'] = 4;
printMapBackwards(mp);
return 0;
}
/*
run:
y: 4
x: 7
r: 9
a: 1
*/