#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void)
{
const int VECTOR_SIZE = 8;
typedef vector<int> IntVector;
typedef IntVector::iterator IntVectorIt;
IntVector Numbers(VECTOR_SIZE);
IntVector Result(4);
IntVectorIt start, end, it;
Numbers[0] = 4;
Numbers[1] = 10;
Numbers[2] = 70;
Numbers[3] = 30;
Numbers[4] = 10;
Numbers[5] = 69;
Numbers[6] = 96;
Numbers[7] = 7;
start = Numbers.begin();
end = Numbers.end();
for (it = start; it != end; it++)
cout << *it << " ";
partial_sort_copy(start, end, Result.begin(), Result.end());
for(it = start; it != end; it++)
cout << *it << " ";
for(it = Result.begin(); it != Result.end(); it++)
cout << *it << " ";
}
|