Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vector<int> v = {9, 2, 5, 1};
- auto isEven = [](const int& a){ return a % 2 == 0; };
- cout << (any_of(v.begin(), v.end(), isEven) ? "Yes\n" : "No\n"); //outputs: Yes
- v = {9, 3, 5, 1};
- cout << (any_of(v.begin(), v.end(), isEven) ? "Yes\n" : "No\n"); // outputs: No
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement