第1个回答 2007-05-29
#include <iostream>
#include <algorithm>
#include <iterator>
using namespace std;
bool IsOdd(int n)
{
return n & 1;
}
int main()
{
int a[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
int* beg = a;
int* end = a + sizeof a / sizeof a[0];
sort(beg, end);
stable_partition(beg, end, IsOdd);
copy(beg, end, ostream_iterator<int>(cout, " "));
}本回答被提问者采纳