-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4.cpp
More file actions
48 lines (31 loc) · 747 Bytes
/
Copy path4.cpp
File metadata and controls
48 lines (31 loc) · 747 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
43
44
45
46
47
48
#include <iostream>
#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);
//replace_if(v.begin(),v.end(),[] (int x){return x%2==0;},69);
replace(v.begin(),v.end(),2,69);
for(int xyz: v)
{
cout<<xyz<<" ";
}
cout<<""<<endl;
vector<int> v12(v.size());
adjacent_difference(v.begin(),v.end(),v12.begin());
cout<<"adjacent difference : "<<endl;
for(int xyz: v12)
{
cout<<xyz<<" ";
}
cout<<endl;
if(any_of(v12.begin(),v12.end(),[](int &x){return x%2==0;}))
{
cout<<"atleast 1 element is divisible by 2"<<endl;
}
}