why didn't the positive terms get displayed in this asbolute program
<p>Let's start with this demo</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

template &lt;class T&gt;
void abs(T number)
{
   if (number &lt; 0)
        number = -number;
   cout &lt;&lt; "The absolute value of the number is " &lt;&lt; number &lt;&lt; endl;
   return;
}

int main()
{
   int num1 = 1;
   int num2 = 2;
   double num3 = -2.1333;
   float num4 = -4.23f;

   abs(num1);
   abs(num2);
   abs(num3);
   abs(num4);

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

<p>The output only showed num3 and num4 in its absolute value form. num1 and 2 were never displayed. </p>

<p>But doesn't program reads from top to bottom? I thought that if num1 is greater than 0, then it should, by all means, go to cout statement, and i.e., print 1.</p>

<p>It seems like this template function is omitting for those that are not negative in the beginning....</p>

<p>I tested without using the template function, and worked fine.</p>

<p>Thank you</p>
