foreach0.cpp

We use cookies. Read the Privacy and Cookie Policy

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;

}