title: Print leading zeros with C++ output operator?
body: <p>How can I format my output in C++? In other words, what is the C++ equivalent to the use of <code>printf</code> like this:</p>
  
  <pre><code>printf("%05d", zipCode);
  </code></pre>
  
  <p>I know I could just use <code>printf</code> in C++, but I would prefer the output operator <code>&lt;&lt;</code>.</p>
  
  <p>Would you just use the following?</p>
  
  <pre><code>std::cout &lt;&lt; "ZIP code: " &lt;&lt; sprintf("%05d", zipCode) &lt;&lt; std::endl;
  </code></pre>