title: Decimal points with std::stringstream?
body: <p>I have a bunch of integers that I put into <code>stringstream</code>s. Now I want to change the <code>stringstream</code>s into <code>string</code>s while keeping a constant precision with the <code>string</code>s. How would I do that? I know I can use <code>stringstreams.precision()</code>, but it's not working for some reason:</p>
  
  <pre><code>float a = 5.23;
  float b = 3.134;
  float c = 3.0;
  
  std::stringstream ta;
  std::stringstream tb;
  std::stringstream tc;
  
  ta &lt;&lt; a;
  tb &lt;&lt; b;
  tc &lt;&lt; c;
  
  ta.precision(2);
  tb.precision(2);
  tc.precision(2);
  
  std::string out = "";
  out += ta.str() + "\n";
  out += tb.str() + "\n";
  out += tc.str() + "\n";
  </code></pre>
  
  <p>Will return <code>5.23\n3.134\n3.0</code>, rather than <code>5.23\n3.13\n3.00</code></p>