replcpy1.cpp

replcpy1.cpp

#include ‹stl.h›

#include ‹iostream.h›

int numbers[6] = {0, 1, 2, 0, 1, 2};

int result[6] = {0, 0, 0, 0, 0, 0};

int main() {

 replace_copy(numbers, numbers + 6, result, 2, 42);

 for (int i = 0; i ‹ 6; i++) cout ‹‹ result[i] ‹‹ ;

 cout ‹‹ endl;

 return 0;

}