title: c++ Save Int with leading zeros to String, NOT displaying them
body: <p>I can format an <code>Int</code> to display a number with leading zeros, but I can't figure out how to save an <code>Int</code> with the zeros to a <code>string</code>.</p>
  
  <p>Reason: Loading image files that end in <code>"..0001" "..0002" ... "..0059"</code> etc.</p>
  
  <p>I have this, but it doesn't work:</p>
  
  <pre><code>int a;
  for(int i = 1; i &lt; imgArraySize + 1; i++)
  {
      cout &lt;&lt; setw(4) &lt;&lt; setfill('0') &lt;&lt; i &lt;&lt; '\n';
      cin &gt;&gt; a;
      string aValue = to_string(a);
  
      imageNames.push_back(string("test_images" + aValue + ".jpg"));
  }
  </code></pre>