Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Change Theme, Dark/Light
Go to 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}; int amount = count_if(numbers.begin(), numbers.end(), greater_than_5); cout << "There are " << amount << " values greater than 5."; return 0; }
There are 2 values greater than 5.