title: Addition and subtraction of arrays
body: <p>I have been working on this all day but just cant get the output right. 
  What I want to do is input two numbers, which would be pushed into two arrays so we can subtract or add them and display the result. Seems simple, but there are few catches </p>
  
  <ol>
  <li>Input must be pushed into the array, from the user, one by one.</li>
  <li>In case I don't enter a value, code should assume it to be <code>'0'</code> or <code>'null'</code>. <code>'0'</code> if its in the beginning and <code>'null'</code> if its in the end. for example if 1st number is <code>234</code> and second number is <code>23</code> then code should make it into <code>'023'</code> and if I enter first number as <code>2</code>, 2nd number as <code>3</code> but don't enter anything in the end then code should assume it to be <code>null</code>.</li>
  </ol>
  
  <p>Problems</p>
  
  <ol>
  <li>I cant take 'carry' to the next set, in case the sum is greater than <code>10</code>. Which means the value I m getting is just addition of two numbers doesn't matter if its greater than 10 or not. for example addition of <code>234</code> and <code>890</code> is giving me <code>[10, 12, 4]</code></li>
  </ol>
  
  <p>Here is the code.....</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  
  main() {
      int first[10], second[10], result[10], c, n;
  
      cout &lt;&lt; "Enter the number of elements in the array ";
      cin &gt;&gt; n;
      if (n &gt; 10 || n &lt; 0) {
          std::cout &lt;&lt; "invalid number, you are a bad reader" &lt;&lt; endl;
          system("PAUSE");
          return 0;
      }
  
      cout &lt;&lt; "Enter elements of first array " &lt;&lt; endl;
  
      for (c = 0; c &lt; n; c++) {
          cin &gt;&gt; first[c];
          if (first[c] &gt; 9 || first[c] &lt; 0) {
              std::cout &lt;&lt; "invalid number, you are a bad reader" &lt;&lt; endl;
              system("PAUSE");
              return 0;
          }
  
      }
      cout &lt;&lt; "Enter elements of second array " &lt;&lt; endl;
  
      for (c = 0; c &lt; n; c++)
          cin &gt;&gt; second[c];
  
      cout &lt;&lt; "Sum of elements of two arrays " &lt;&lt; endl;
  
      for (c = 0; c &lt; n; c++)
          cout &lt;&lt; first[c] + second[c] &lt;&lt; endl;
  
      if ((first[c] + second[c]) &gt; 9) {
          cout &lt;&lt; "overflow" &lt;&lt; endl;
      }
  
      //result[c] = first[c] + second [c];
      //cout &lt;&lt; result[c] &lt;&lt;endl;
      system("PAUSE");
      return 0;
  }
  </code></pre>
  
  <p>I would really appreciate some suggestions. </p>