title: Formatting output in C++
body: <p>In a C++ code I have a matrix of double variables which I print out. However because all of them have different number of digits, the output format is destroyed. One solution is to do
  <code>cout.precision(5)</code> but I want different columns have a different precision. Also, because there are negative values in some cases, the presence of the <code>-</code> sign also causes problems. How to get around this and produce a properly formatted output?</p>