title: Storing digits in array, C++
body: <p>I'm taking the digits from a number, how can I store them in an array? </p>
  
  <pre><code>int main()
  {
      int n;
      std::cin&gt;&gt;n;
      while (n &gt; 0)
          {
              int digit = n%10;
              n /= 10;
              std::cout&lt;&lt;digit&lt;&lt;" ";
          }
  
      return 0;
  }
  </code></pre>