Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. vector<int> v = {9, 2, 5, 1};
  2. auto isEven = [](const int& a){ return a % 2 == 0; };
  3. cout << (all_of(v.begin(), v.end(), isEven) ? "Yes\n" : "No\n"); //outputs: No
  4. v = {2, 4, 6};
  5. cout << (all_of(v.begin(), v.end(), isEven) ? "Yes\n" : "No\n"); // outputs: YES
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement