title: iomanip operations are returning a hex value
body: <p>I am trying to take a <code>double</code> and output it as currency by using <code>iomanip</code> and writing my own stream manipulator. I do so by writing a method which returns an ostream and takes an ostream as an argument (as well as two integer arguments, width and precision)</p>
  
  <pre><code>std::ostream&amp; Currency(std::ostream&amp; os, int width, int precision)
  {
      os &lt;&lt; "$";
      os &lt;&lt; std::setprecision(precision);
      os &lt;&lt; std::right;
      os &lt;&lt; std::setw(width);
      os &lt;&lt; std::fixed &lt;&lt; std::setfill('0');
      return os;
  }
  </code></pre>
  
  <p>However, instead of the output I'm expecting, <code>$0000128.00</code>, I get the output <code>$0x7ffeb45783d8128.00</code>.</p>
  
  <p>I simply call it like so:</p>
  
  <pre><code>cout &lt;&lt; Currency(cout, 11, 2) &lt;&lt; balance &lt;&lt; endl;
  </code></pre>
  
  <p>Not sure what the problem is, it seems to be something to do with it being wrapped in a function. If I copy the exact code not in a function to my actual output then it works perfectly.  </p>
  
  <p>Also before I run my Currency manipulator on the balance I also run:</p>
  
  <pre><code>out &lt;&lt; std::right &lt;&lt; std::setfill('0') &lt;&lt; std::setw(10) &lt;&lt; a.accountNo &lt;&lt; " ";
  out &lt;&lt; std::setfill(' ') &lt;&lt; std::left &lt;&lt; std::setw(19) &lt;&lt; a.name &lt;&lt; " ";
  out &lt;&lt; std::setfill(' ') &lt;&lt; std::left &lt;&lt; std::setw(3) &lt;&lt; a.sex &lt;&lt; " ";
  out &lt;&lt; std::setfill(' ') &lt;&lt; std::left &lt;&lt; std::setw(10) &lt;&lt; a.dob.toString() &lt;&lt; " ";
  out &lt;&lt; std::setfill(' ') &lt;&lt; std::left &lt;&lt; std::setw(40) &lt;&lt; a.address &lt;&lt; " ";
  </code></pre>