title: 1 byte unsigned integer c++
body: <p>I have programmed a class called HugeInteger which can do arithmetic (add, sub, multiply) with numbers of "infinitely" size. It treats each bit of the digit in the number as a stand-alone digit (e.g. 1234 = 1, 2, 3 and 4). I store these numbers in a vector <code>(vector&lt;short&gt;)</code>. Now, because each digit only can take the values from 0 to 9, i don't really need to store them as a 2 byte digit. Is there a way (without using char) to store the digits as a 1 byte unsigned integer? Thanks!</p>
  
  <p>Update:</p>
  
  <pre><code>vector&lt;unsigned char&gt; v;
  v.push_back(1);
  v.push_back(2);
  
  for (size_t i = 0; i &lt; v.size(); i++)
      cout &lt;&lt; v[i];
  </code></pre>
  
  <p>This produces an unwanted output. Which datatype should I use to iterate through the vector?</p>