#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void init_vectorObject(vector<int> &vectorObject)
{
vectorObject[0] = 1;
vectorObject[1] = 10;
vectorObject[2] = 2;
vectorObject[3] = -3;
vectorObject[4] = 9;
vectorObject[5] = 4;
vectorObject[6] = 8;
vectorObject[7] = 5;
vectorObject[8] = 7;
vectorObject[9] = 6;
}
int main()
{
vector<int> vectorObject(10);
int i;
init_vectorObject(vectorObject);
cout << "Original order:";
for(i = 0; i <10; i++)
cout << vectorObject[ i ] << " ";
cout << endl;
partial_sort(vectorObject.begin(), vectorObject.begin()+5, vectorObject.end());
cout << "Order after partial sorting:";
for(i = 0; i <10; i++)
cout << vectorObject[ i ] << " ";
cout << endl;
return 0;
}
|