What happens when you attempt to compile and run the following code?
#include
#include
#include
#include
using namespace std;
void myfunction(int i) {
cout << " " << i;
}
int main() {
int t[] = { 1, 5, 2, 5, 2, 4, 4, 3, 3, 1 };
vector
set
replace(v1.begin(), v1.end(), 1, 10);
replace(s1.begin(), s1.end(), 1, 10);
for_each(v1.begin(), v1.end(), myfunction);
return 0;
}
Program outputs:
Currently there are no comments in this discussion, be the first to comment!