codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include <algorithm> #include <functional> #include <iostream> int main() { double arr[] = {-1,-2,-3,4,-5,-6,-7,8,-9,-10,11}; const size_t N = sizeof(arr) / sizeof(arr[0]); double* first = std::find_if(arr, arr+N, std::bind2nd(std::greater<double>(), 0.0)); double* second = std::find_if(++first, arr+N, std::bind2nd(std::greater<double>(), 0.0)); std::cout << std::accumulate(first, second, 0.0) << std::endl; return 0; }
Private
[
?
]
Run code
Submit