[ create a new paste ] login | about

Link: http://codepad.org/fa9juxNS    [ raw code | output | fork ]

C++, pasted on Dec 20:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <algorithm>
#include <iostream>
#include <cstddef>
#include <boost/lambda/lambda.hpp>

bool IsMoreNagativeNumbersInFirstArray(const int* first, std::size_t sizeFirst, const int* second, std::size_t sizeSecond) {
  return std::count_if(first , first  + sizeFirst , boost::lambda::_1 < 0) >
         std::count_if(second, second + sizeSecond, boost::lambda::_1 < 0);       
}

int main() {
  int first [] = { 0, -1,  2, -3,  4, -5 };
  int second[] = { 0,  1, -2,  3, -4,  5 };
  
  std::cout << IsMoreNagativeNumbersInFirstArray(first , sizeof(first ) / sizeof(first [0]), 
                                                 second, sizeof(second) / sizeof(second[0])) << std::endl;

  return 0;           
}


Output:
1
true


Create a new paste based on this one


Comments: