Sorting in C++

Tags:

#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
	
using namespace std;
	
int main()
{
	
        vector<int> v;
        for (int i = 0; i < 1000; i++)
        {
                v.push_back(1000 - i);
        }
	
        sort(v.begin(), v.end(), less<int>());
        copy(v.begin(), v.end(), ostream_iterator<int>(cout, ” “));
        return EXIT_SUCCESS;
}

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *