Search
 
SCRIPT & CODE EXAMPLE
 

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;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: check if character is uppercase c++ 
Cpp :: c++ get environment variable 
Cpp :: c++ enum 
Cpp :: how to scan array in c++ 
Cpp :: header file for unordered_map in c++ 
Cpp :: What is the story of c++ 
Cpp :: what does the modularity mean in c++ 
Cpp :: clear the input buffer in cpp 
Cpp :: set was not declared in this scope 
Cpp :: destructor in c++ 
Cpp :: C++ program that prints the prime numbers from 1 to 1000. 
Cpp :: c++ standard library source 
Cpp :: c++ remove last character from string 
Cpp :: c++ vector declaration 
Cpp :: uses of gamma rays 
Cpp :: c++ vector push if not exist 
Cpp :: factorial function c++ 
Cpp :: c++ cast to type of variable 
Cpp :: how to sort vector of struct in c++ 
Cpp :: initialize dynamic array c++ to 0 
Cpp :: how to set a variable to infinity in c++ 
Cpp :: c++ vector of class objects 
Cpp :: C++ fill string with random uppercase letters 
Cpp :: c elif 
Cpp :: automatic legend matlab 
Cpp :: length of array c++ 
Cpp :: c++ header boilerplate 
Cpp :: size of a matrix using vector c++ 
Cpp :: How to turn an integer variable into a char c++ 
Cpp :: c++ inheritance 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =