title: How to read double digits and single digits in C++
body: <p>I have an issue where I cannot get my C++ program to read double digit integers. 
  My idea is to read it as string and then somehow parse it into separate integers and insert them into an array, but I am stuck on getting the code to read digits properly.</p>
  
  <p>Sample Output:</p>
  
  <pre><code> i: 0 codeColumn 0
  
   i: 1 codeColumn 1
  
   i: 2 codeColumn 0 0
  
   i: 3 codeColumn 0
  
   i: 4 codeColumn 31 0
  
   i: 5 codeColumn 1
  
   i: 6 codeColumn 43 0
  
   i: 7 codeColumn 3
  
   i: 8 codeColumn 9 0
  </code></pre>
  
  <p>So the file is basically a line of triplets delimited by a comma:</p>
  
  <pre><code>0,1,0 0,0,31 0,0,18 0,0,8 0,11,0
  </code></pre>
  
  <p>My question is how do you get the trailing zeroes (see above) to move to a new line? I tried using "char" and a bunch of if statements to concatenate the single digits into double digits, but I feel like that's not really efficient or ideal. Any ideas?</p>
  
  <p>My code: </p>
  
  <pre><code>#include &lt;iostream&gt;     // Basic I/O
  #include &lt;string&gt;       // string classes
  #include &lt;fstream&gt;      // file stream classes
  #include &lt;sstream&gt;
  #include &lt;vector&gt;
  
  int main()
  {
  
      ifstream fCode;
      fCode.open("code.txt"); 
      vector&lt;string&gt; codeColumn;
  
      while (getline(fCode, codeLine, ',')) {
          codeColumn.push_back(codeLine);
      }
  
      for (size_t i = 0; i &lt; codeColumn.size(); ++i) {
  
                  cout &lt;&lt; " i: " &lt;&lt; i &lt;&lt; " codeColumn " &lt;&lt; codeColumn[i] &lt;&lt; endl;
  
      }
  
      fCode.close();
  
  }
  </code></pre>