#include#include int main() { int a = 4; int b = 6; std::cout << "The maximum value is: " << std::max(a, b) << std::endl; return 0; }
The maximum value is: 6
#include#include #include int main() { std::array arr = {1.2, 2.5, 5.6, 8.9, 3.2}; double max_val = *std::max_element(arr.begin(), arr.end()); std::cout << "The maximum value is: " << max_val << std::endl; return 0; }
The maximum value is: 8.9In both examples, the std::max function was used to determine the maximum comparison value between two given parameters. The first example used two integers, while the second example made use of an array of doubles. The library used in both examples is the C++ Standard Library.