Skip to content

Instantly share code, notes, and snippets.

@virtuosonic
Created October 19, 2022 22:12
Show Gist options
  • Save virtuosonic/76cd3274f043b0f3fa73c2d369c65539 to your computer and use it in GitHub Desktop.
Save virtuosonic/76cd3274f043b0f3fa73c2d369c65539 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
using namespace std;
bool isEven(int n ){
return !(n % 2);
}
void printEvenness(int x){
cout << x << " is even: " << std::boolalpha << isEven(x) << endl;
}
int main()
{
auto n1 = 5;
vector<int> ints { 5,3,4,62,7,12,35,44,88,1,9,2} ;
for_each(ints.begin(), ints.end(), printEvenness);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment