Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ find_if

#include <bits/stdc++.h>
using namespace std;
int main()
{
    vector<int>v ;
    v.push_back(1);
    v.push_back(2);
    v.push_back(3);
    v.push_back(4);
    v.push_back(5);
    v.push_back(6);
    vector<int>::iterator it;
    it=find_if(v.begin(),v.end(),[](int val){return val % 4 == 0;});
    if(it!=v.end())
    cout<<it-v.begin()<<endl;
    return 0;
}
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
5+1 =