#include <iostream> #include <vector> #include <algorithm> using namespace std; /* Example of simple program to print all the elements of vector */ int main() { //Initialize the vector vector<int> MyVec={0, 0, 0 ,0, 0, 3 ,2 ,8, 11, 10 ,15, 22}; MyVec.push_back(3); //print out all the elements of the vector int count=count_if(MyVec.begin(),MyVec.end(),[](int elem){ return elem==0;}); cout<<"Count of zeroes is "<<count; return 0; }

Loading Please Wait...