#include <iostream>
#include <vector>
#include <algorithm> // for sort
#include <functional> // for less & greater
int main()
{
int x[10] = { 1,3,5,7,9,2,4,6,8,10 };
std::cout << "Ascending: " << std::endl;
std::sort(x,x+10,std::less<int>());
for(int i = 0; i < 10; ++i)
std::cout << x[i] << " ";
std::cout << std::endl << "Descending: " << std::endl;
std::sort(x,x+10,std::greater<int>());
for(int i = 0; i < 10; ++i)
std::cout << x[i] << " ";
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8YWxnb3JpdGhtPiAgICAvLyBmb3Igc29ydAojaW5jbHVkZSA8ZnVuY3Rpb25hbD4gICAvLyBmb3IgbGVzcyAmIGdyZWF0ZXIKCmludCBtYWluKCkKewogICAgaW50IHhbMTBdID0geyAxLDMsNSw3LDksMiw0LDYsOCwxMCB9OwoKICAgIHN0ZDo6Y291dCA8PCAiQXNjZW5kaW5nOiAiIDw8IHN0ZDo6ZW5kbDsKICAgIHN0ZDo6c29ydCh4LHgrMTAsc3RkOjpsZXNzPGludD4oKSk7CiAgICBmb3IoaW50IGkgPSAwOyBpIDwgMTA7ICsraSkKICAgICAgICBzdGQ6OmNvdXQgPDwgeFtpXSA8PCAiICI7CgogICAgc3RkOjpjb3V0IDw8IHN0ZDo6ZW5kbCA8PCAiRGVzY2VuZGluZzogIiA8PCBzdGQ6OmVuZGw7CiAgICBzdGQ6OnNvcnQoeCx4KzEwLHN0ZDo6Z3JlYXRlcjxpbnQ+KCkpOwogICAgZm9yKGludCBpID0gMDsgaSA8IDEwOyArK2kpCiAgICAgICAgc3RkOjpjb3V0IDw8IHhbaV0gPDwgIiAiOwp9Cg==