-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDAY10.cpp
More file actions
58 lines (52 loc) · 916 Bytes
/
DAY10.cpp
File metadata and controls
58 lines (52 loc) · 916 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
49
50
51
52
53
54
55
56
57
58
//selfmadesort and rotate function
#include<iostream>
#include<algorithm>
using namespace std;
bool selfMadesort(int n1,int n2)
{
return n1>n2;
}
int main()
{
int arr[]={17,1,2,3,6,2,96,354,6,34};
int n=sizeof(arr)/sizeof(arr[0]);
sort(arr,arr+n,selfMadesort);
for(auto a:arr)
{
cout<<a<<" ";
}
cout<<endl;
rotate(arr,arr+n-2,arr+n);
for(auto a:arr)
{
cout<<a<<" ";
}
cout<<endl;
return 0;
}
//nested function
#include<iostream>
using namespace std;
bool fun1(int n1,int n2)
{
cout<<"hello, i am fun1";
return n1>n2;
}
int fun2(bool (&umang)(int n1 ,int n2))
{
cout<<"hello, i am fun2";
int n1 = 15;
int n2 = 17;
if(umang(n1, n2))
{
return 5;
}
else{
return 15;
}
}
int main()
{
cout<<fun2(fun1())<<endl;
return 0;
}