#include #include #include #include using namespace std; bool greaterThan3(int value) { return value > 3; } int main() { int values[] = {1, 7, 3, 4, 3, 6, 1, 2}; list intList(values, values + 8); ostream_iterator output(cout, " "); cout << "Initial contents, values: "; copy(values, values + 8, output); cout << "\nInitial contents, intList: "; copy(intList.begin(), intList.end(), output); replace(values, values + 8, 3, 747); replace_if(intList.begin(), intList.end(), greaterThan3, 747); cout << "\nAfter the replace function, values: "; copy(values, values + 8, output); cout << "\nAfter the replace_if function, intList: "; copy(intList.begin(), intList.end(), output); return 0; }