fork download
  1. #include <algorithm>
  2. #include <vector>
  3. #include <iostream>
  4. #include <functional>
  5. #include <iterator>
  6. using namespace std;
  7.  
  8.  
  9. struct check_mod_7 : unary_function<int, bool>
  10. {
  11. bool operator()(const int& zahl) const
  12. {
  13. return zahl%7==0;
  14. }
  15. };
  16.  
  17. int main()
  18. {
  19. int ar[] = { 5,7,14,21,28,29};
  20. vector<int> v(ar,ar+6);
  21.  
  22. vector<int> mod_7;
  23.  
  24. remove_copy_if(v.begin(), v.end(), back_inserter(mod_7), not1(check_mod_7()));
  25.  
  26. for(auto iter = mod_7.begin(); iter != mod_7.end(); ++iter)
  27. cout << *iter << endl;
  28. }
Success #stdin #stdout 0s 3016KB
stdin
Standard input is empty
stdout
7
14
21
28