Maximum of three values in C++
If you have access to C++11, I'd suggest using std::max with an initializer_list&lt;T&gt;. A complete minimal example:

#include &lt;algorithm&gt;
#include &lt;initializer_list&gt;
#include &lt;iostream&gt;

int main()
{
    int a = 1;
    int b = 2;
    int c = 3;

    int m = std::max({a, b, c});

    std::cout &lt;&lt; m &lt;&lt; "\n";
}