fork download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. vector<int> vec = { 1, 2, 3, 4, 5 };
  8. for (auto& val : vec)
  9. if (val % 2 != 0)
  10. val++;
  11. for (auto val : vec)
  12. cout << val << endl;
  13. return 0;
  14. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
2
2
4
4
6