C++ underflow and overflow
<p>Hi I am new in here so please let me know if anything is wrong and I will try to better the next time . </p>

<p>I am trying to understand how underflow and overflow works in C++ .My understanding is if a variable's range is exceeded it will start from the other end of the range . Thus if minimum of short is -32768 and if we do a -1 to it the new value should be SHRT_MAX .(32767) 
Here is my code: </p>

<pre><code>#include&lt;iostream.h&gt;
#include&lt;limits.h&gt;
#include&lt;conio.h&gt;
int main ( void )
{
 int testpositive =INT_MIN ;
 short testnegative = SHRT_MIN ; 
 cout&lt;&lt; SHRT_MIN&lt;&lt;"\n";
 cout &lt;&lt; testnegative-1&lt;&lt;"\n";
 cout &lt;&lt; INT_MIN &lt;&lt; "\n";
 cout &lt;&lt; testpositive-1 &lt;&lt; "\n"; 
 cout&lt;&lt;testpositive-2;
 getch();
 return 0;
}   
</code></pre>
