fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <functional>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int a = 2;
  10. int arr[] = { 1, 5, 6, 2, 7, 8, 3, 4, 1, 3, 3 };
  11. cout << count_if(begin(arr), end(arr), bind2nd(not2(equal_to<int>()), *(end(arr) - 1))) << endl;
  12. cout << count_if(begin(arr), end(arr), bind2nd(not2(modulus<int>()), a)) << endl;
  13. return 0;
  14. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
8
4