运行 ❯
建立您
自己的
网站
×
更改方向
更改主题,深色/浅色
前往 Spaces
#include <iostream> #include <vector> #include <algorithm> using namespace std; bool greater_than_5(int value) { return value > 5; } int main() { vector<int> numbers = {1, 7, 3, 5, 9, 2}; if (any_of(numbers.begin(), numbers.end(), greater_than_5)) { cout << "Found a value greater than 5"; } else { cout << "No values are greater than 5"; } return 0; }
找到一个大于5的值