title: c++ format cout with "right" and setw() for a string and float
body: <p>I am trying to format a 'cout' where it has to display something like this:</p>
  
  <pre><code>Result       $ 34.45
  </code></pre>
  
  <p>The amount ($ 34.45) has to be on right index with certain amount of padding or end at certain column position.  I tried using </p>
  
  <pre><code>cout &lt;&lt; "Result" &lt;&lt; setw(15) &lt;&lt; right &lt;&lt; "$ " &lt;&lt; 34.45" &lt;&lt; endl;
  </code></pre>
  
  <p>However, it's setting the width for the "$ " string, not for the string plus amount.</p>
  
  <p>Any advice on dealing with such formatting?</p>