How can I properly use Inline functions? C++ - What type does it have to be?
<p>doubles seem not to work. can I only use int?<br>
I heard that I can use C++ function templates to change this to double. I'm not sure how to go about that though.</p>

<pre><code> #include &lt;iostream&gt;                                                     // Necessary 
using namespace std;
#define mMaxOf2(max, min) ((max) &gt; (min) ? (max) : (min))
#define mMaxOf3(Min, Mid, Max)\
{\
     mMaxOf2(mMaxOf2((Min), (Mid)),(Max))\
}
inline long double fMaxOf2(long double min, long double max)
{
    return max &gt; min ? max : min;
}

inline long double fMaxOf3(long double Min, long double Mid, long double Max)
{
      return fMaxOf2(Min, fMaxOf2( Mid, Max));
    //fMaxOf2(Min, fMaxOf2( Mid, Max));     caused nan   problem      
}

int main()
{
    double primary;
    double secondary;
    double tertiary;

    cout &lt;&lt; "Please enter three numbers: ";
    cin &gt;&gt; primary &gt;&gt; secondary &gt;&gt; tertiary;
    cout &lt;&lt; "The maximum of " &lt;&lt; primary &lt;&lt; " " &lt;&lt; secondary &lt;&lt; " " &lt;&lt; tertiary;

    long double maximum = mMaxOf3(primary, secondary, tertiary);
    cout &lt;&lt; " using mMaxOf3 is " &lt;&lt; maximum;

    cout &lt;&lt; "\nThe maximum of " &lt;&lt; primary &lt;&lt; " " &lt;&lt; secondary &lt;&lt; " " &lt;&lt; tertiary;
    long double maxim = fMaxOf3(primary, secondary, tertiary);
    cout &lt;&lt; " using fMaxOf3 is " &lt;&lt; maxim;

    return 0;
}
</code></pre>

<p>So the problem was </p>

<pre><code>    inline long double fMaxOf2(long double min, long double max)
    {
        return max &gt; min ? max : min;
    }

    inline long double fMaxOf3(long double Min, long double Mid, long double Max)
    {
        fMaxOf2(Min, fMaxOf2( Mid, Max));    // This was wrong
        // It was fMaxOf2 (fMaxOf2(Min, Mid, Max);
    }
</code></pre>

<p>Anyway now I get a new error... says maxim is nan... 
Solved it. Thanks Everyone!</p>
