fork download
  1. #include <vector>
  2. #include <algorithm>
  3. #include <iostream>
  4. #include <iterator>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. std::vector<int> Array1 = {3,6,9,5,10,21,3,25,14,12,32,41,3,24,15,26,7,8,11,4};
  11. std::vector<float> Array2 = {3,6,9,5,6, 21,3,25, 4,12,32,41,3,24,15,26,7,8,11,4};
  12.  
  13. int i = 0;
  14.  
  15. auto remove = remove_if(
  16. Array1.begin(),
  17. Array1.end(),
  18. [&Array2, &i](auto dummy)
  19. {
  20. return Array2[i++] > 9;
  21. });
  22.  
  23. Array1.erase(remove, Array1.end());
  24. copy(Array1.begin(), Array1.end(), ostream_iterator<int>(cout, " "));
  25.  
  26. }
  27.  
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
3 6 9 5 10 3 14 3 7 8 4