max_element c++
int arr[] = {1,4,2,10};
int n = 4; //size of array
cout<<*max_element(arr,arr+n);
// Output: 10
max_element c++
int arr[] = {1,4,2,10};
int n = 4; //size of array
cout<<*max_element(arr,arr+n);
// Output: 10
max function in c++
// C++ program to demonstrate the use of std::max
// C++ program to demonstrate the use of std::max
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
// Comparing ASCII values of a and b
cout << std::max('a','b') << "\n";
// Returns the first one if both the numbers
// are same
cout << std::max(7,7);
return 0;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us