Integer limitations in a C++ calculator
<p>Integer limits my answer to <code>-2147483648</code> if I enter two large enough numbers. Can I substitute <code>double v1 = 0, v2 = 0</code> into my code? If I do so, is there a way to make it output the full length of the answer (not <code>5e+17</code> etc.)</p>

<p>Thanks.</p>

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

int main ()
{
cout &lt;&lt; "Enter two numbers: " &lt;&lt; endl;
int v1 = 0, v2 = 0;
cin &gt;&gt; v1 &gt;&gt; v2;
int sum = 0, val = v1;

while (val &lt;= v2)
{
    sum += val;
    ++ val;
}
cout &lt;&lt; "The sum of " &lt;&lt; v1 &lt;&lt; " through " &lt;&lt; v2 &lt;&lt; " inclusive is " &lt;&lt; sum &lt;&lt; endl;

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