| 2 | using namespace std; |
| 3 | |
| 4 | int main() |
| 5 | { |
| 6 | |
| 7 | // initialize container |
| 8 | map<int, int> mp; |
| 9 | |
| 10 | // insert elements in random order |
| 11 | mp.insert({ 2, 30 }); |
| 12 | mp.insert({ 1, 40 }); |
| 13 | mp.insert({ 3, 60 }); |
| 14 | mp.insert({ 4, 20 }); |
| 15 | mp.insert({ 5, 50 }); |
| 16 | |
| 17 | // prints the elements |
| 18 | cout << "\nThe map in reverse order is:\n"; |
| 19 | cout << "KEY\tELEMENT\n"; |
| 20 | for (auto itr = mp.crbegin(); itr != mp.crend(); ++itr) { |
| 21 | cout << itr->first |
| 22 | << '\t' << itr->second << '\n'; |
| 23 | } |
| 24 | return 0; |
| 25 | } |
nothing calls this directly
no outgoing calls
no test coverage detected