1: //none_of1a.cpp 3: #include <iostream> 4: #include <algorithm> 5: #include <vector> 6: using namespace std; 8: int main() 9: { 10: cout << "\nThis program illustrates the use of the STL none_of() " 11: "algorithm from\n<algorithm> to determine whether no value " 12: "in a vector of integers is odd."; 13: cout << "\nPress Enter to continue ... "; cin.ignore(80, '\n'); 15: int a[] = {2, 4, 6, 8, 10, 12, 14}; 16: vector<int> v(begin(a), end(a)); 17: cout << boolalpha; 18: cout << none_of(begin(v), end(v), [](int n){return n%2==1;}) << endl; 19: v.at(2) = 5; 20: cout << none_of(begin(v), end(v), [](int n){return n%2==1;}) << endl; 21: cout << "Press Enter to continue ... "; cin.ignore(80, '\n'); 22: }