fork download
  1. #include <stdio.h>
  2. #include<vector>
  3. #include<algorithm>
  4.  
  5. using namespace std;
  6.  
  7. template <class T>
  8.  
  9. void Ca (const T &x) {printf("\nx = %d\n",x);}
  10.  
  11. int main()
  12.  
  13. {
  14. vector<int> k(5);
  15.  
  16. for (int i=0;i<5;i++)
  17.  
  18. k[i] = i*3;
  19.  
  20. printf("\n*********************\n");
  21.  
  22. for_each(k.begin(),k.end(),Ca<int>);
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
*********************

x = 0

x = 3

x = 6

x = 9

x = 12