Map Descending Order

#include<bits/stdc++.h>
using namespace std;
int main()
{
    map<int, int, greater <int> > p;
    p[0] = 1;
    p[1] = 2;
    p[2] = 3;
    p[3] = 4;
    p[4] = 5;
    p[5] = 6;
    p[6] = 7;
    p[7] = 8;
    p[8] = 9;
    p[9] = 10;
    p[10] = 11;

    for(auto it = p.begin(); it != p.end(); it++)
        cout << it->first << " " << it->second << endl;

    return 0;
}

Comments