This has been asked before. std::max() accepts an initialiser_list, so:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <iostream>
#include <algorithm>
int max(int a, int b, int c)
{
return std::max({a, b, c});
}
int main()
{
constint i {10}, j {34}, k {21};
constint u {max(i, j, k)};
std::cout << "The maximum between " << i <<
" and " << j << " and " << k << " is " << u << '\n';
}