title: Hex addition in C++
body: <p>I want to add an array in Hex. I have done this but I am facing problems in the addition function; it is not adding but showing some pictures.</p>
  
  <pre><code>void addition(char hexDecOne[10], char hexDecTwo[10], char (&amp;hexDecSum)[10]) {
      for (int i = 0; i &lt; 10; i++) {
          // convert to decimal and add both array values
          hexDecSum[i] = convert(hexDecOne[i]) + convert(hexDecTwo[i]);
          // add values and if they are greater than F add 1 to next value
          hexDecSum[i + 1] += hexDecSum[i] / 16;
          hexDecSum[i] %= 16;
      }
  }
  
  int convert(char item) {
      switch (item) {
          case 'A':
              return 10;
              break;
          case 'B':
              return 11;
              break;
          case 'C':
              return 12;
              break;
          case 'D':
              return 13;
              break;
          case 'E':
              return 14;
              break;
          case 'F':
              return 15;
              break;
      }
  }
  </code></pre>
  
  <p>Any help will be appreciated.</p>