fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. void f(int& a)
  8. {++a;}
  9.  
  10. int main() {
  11.  
  12. std::vector<int> v;
  13. v.push_back(12);
  14.  
  15. std::for_each(v.begin(), v.end(), f);
  16.  
  17. for(std::vector<int>::iterator i = v.begin(); i != v.end(); ++i)
  18. cout<<(*i);
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0.01s 2856KB
stdin
Standard input is empty
stdout
13