fork(1) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5. int main()
  6. {
  7. std::vector<int> v { 1, 2, 3, 4, 5 };
  8. auto end = std::end(v);
  9. auto it = std::find(std::begin(v), end, 3);
  10. if(it != end)
  11. *it = 0;
  12.  
  13. v.push_back(6);
  14.  
  15. for(auto const& e : v)
  16. std::cout << e << " ";
  17.  
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
1 2 0 4 5 6