foreach0.cpp
foreach0.cpp
#include ‹stl.h›
#include ‹iostream.h›
void print(int a_) {
cout ‹‹ a_ ‹‹ ;
}
int numbers[10] = {1, 1, 2, 3, 5, 8, 13, 21, 34, 55};
int main() {
for_each(numbers, numbers + 10, print);
cout ‹‹ endl;
return 0;
}
foreach0.cpp
#include ‹stl.h›
#include ‹iostream.h›
void print(int a_) {
cout ‹‹ a_ ‹‹ ;
}
int numbers[10] = {1, 1, 2, 3, 5, 8, 13, 21, 34, 55};
int main() {
for_each(numbers, numbers + 10, print);
cout ‹‹ endl;
return 0;
}