Answers for "max_val in cpp"

C++
1

max_element c++

int arr[] = {1,4,2,10};
int n = 4; //size of array
cout<<*max_element(arr,arr+n);

// Output: 10
Posted by: Guest on February-17-2021
0

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;
}
Posted by: Guest on January-14-2022

Browse Popular Code Answers by Language