-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlambda7.cpp
More file actions
42 lines (37 loc) · 850 Bytes
/
lambda7.cpp
File metadata and controls
42 lines (37 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
// int main()
// {
// vector<int> numbers={1,3,5,8,10,13};
// auto it=find_if(numbers.begin(),numbers.end(),[](int n){
// return n%2==0;
// });
// if(it!=numbers.end()){
// cout<<"first even number found:"<<*it<<endl;
// }
// else{
// cout<<"no even number found"<<endl;
// }
// return 0;
// }
int main()
{
vector<int>numbers={1,3,4,6,7,8};
int flag=0;
for(int i=0;i<numbers.size();i++)
{
if(numbers[i]%2==0)
{
cout<<"first even number is: "<<numbers[i]<<endl;
flag=1;
break;
}
}
if(flag==0)
{
cout<<"no even number is found";
}
return 0;
}