title: The addition of two hexadecimal numerals in c++
body: <p>I'm writing a program that takes two hexadecimal numbers and converts them to decimal form, and prints out their sum in decimal form. The maximum length of the numbers is 10. {submit.cs.ucsb.edu/submission/203504}. I feel confuse about the error messages. The problem wants the max length of the numbers is 10. Why the output like "ffffffffff" works</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  int hexToDecimal(string);
  string decimalToHex(int);
  
  int main()
  {
      long long hex1, hex2;
  
  std::cout &lt;&lt; "Enter first number:" &lt;&lt; std::endl;
  std::cin &gt;&gt; std::hex &gt;&gt; hex1;
  
  std::cout &lt;&lt; "Enter a second number:" &lt;&lt; std::endl;
  std::cin &gt;&gt; std::hex &gt;&gt; hex2;
  
  if (hex1 &gt;9999999999 || hex2 &gt; 9999999999)
  
  {
      cout &lt;&lt; "Addition Overflow" &lt;&lt; endl;
  }
  else
  {
      std::cout &lt;&lt; "The sum is "&lt;&lt; std::hex &lt;&lt; hex1 + hex2 &lt;&lt; "." &lt;&lt; std::endl;
  
  }
  
  
  return 0;
  }
  </code></pre>