64,689
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <algorithm>
using namespace std;
void Modify(int * array, int& size)
{
int i = 0, j = 0;
for (;j<size;++j)
(array[i]=array[j])%2==0&&++i;
size = i;
}
int main(int argc, char* argv[])
{
int array[] = {1,3,4,2,3,4,6};
int size = sizeof(array)/sizeof(array[0]);
Modify(array, size);
copy(array, array+size, ostream_iterator<int>(cout,"\t"));
return 0;
}