- Notifications
You must be signed in to change notification settings - Fork 366
/
Copy pathmax_array.cpp
executable file
·54 lines (42 loc) · 809 Bytes
/
max_array.cpp
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
// #include<bits/stdc++.h>
// using namespace std;
// void initial(){
// #ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
// }
// int main(){
// initial();
// int a[]={112,113,44,555,77665,787654};
// int n= sizeof(a)/ sizeof(int);
// cout<<"maximum ="<<*max_element(a,a+n);
// return 0;
// }
#include<bits/stdc++.h>
usingnamespacestd;
intmax_arr(int arr[],int n){
int max=arr[0];
for (int i = 1; i < n; ++i)
{
if (max<arr[i])
{
max=arr[i];
}
}
cout<<max<<endl;
return0 ;
}
voidinitial(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
intmain(){
initial();
int arr[]={12,13,14,15,17776,177};
int n = sizeof(arr)/ sizeof(int );
max_arr(arr,n);
return0;
}