#include <iostream>     // std::cout
#include <algorithm>    // std::any_of
#include <array>        // std::array
using namespace std;
int main () {
    array<int,7> foo = {0,1,-1,3,-3,5,-5};
    
    if ( any_of(foo.begin(), foo.end(), [](int i){return i<0;}) )
        cout << "There are negative elements in the range.\n";
    
    return 0;
}

 

相关文章:

  • 2021-11-07
  • 2022-12-23
  • 2021-11-17
  • 2021-07-19
  • 2021-06-22
  • 2021-07-21
猜你喜欢
  • 2021-08-26
  • 2021-05-23
  • 2022-12-23
  • 2021-10-25
  • 2022-02-13
  • 2022-12-23
相关资源
相似解决方案