title: Setting precision on std::cout in entire file scope - C++ iomanip
body: <p>I'm doing some calculations, and the results are being save in a file. I have to output very precise results, near the precision of the double variable, and I'm using the iomanip setprecision(int) for that. The problem is that I have to put the setprecision everywhere in the output, like that:</p>
  
  <pre><code>func1() {
  cout&lt;&lt;setprecision(12)&lt;&lt;value;
  cout&lt;&lt;setprecision(10)&lt;&lt;value2;
  }
  func2() {
  cout&lt;&lt;setprecision(17)&lt;&lt;value4;
  cout&lt;&lt;setprecision(3)&lt;&lt;value42;
  }
  </code></pre>
  
  <p>And that is very cumbersome. Is there a way to set more generally the cout fixed modifier?</p>
  
  <p>Thanks</p>