title: c++ cout << [double] not printing decimal places
body: <p>I have a simple C++ program that I thought would print out a double value defined in f and g as doubles ... but C++ is printing them out as integers.  I checked the default precision of cout, and when I run it the output says the default precision should be 6 so I'm confused as to why the double isn't printing properly.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdio.h&gt;
  int main() {
  
      double f = 735416.416898;
      double g = f + 0.3;
  
      std::cout &lt;&lt; "default precision is " &lt;&lt; std::cout.precision() &lt;&lt; std::endl;
  
      std::cout &lt;&lt; "[c++] f = " &lt;&lt; f &lt;&lt; std::endl;
      std::cout &lt;&lt; "[c++] g = " &lt;&lt; g &lt;&lt; std::endl;
      printf("[c] f = %f\n", f);
      printf("[c] g = %f\n", g);
  
      f = 735416.516898;
      g = f + 0.3;
  
      std::cout &lt;&lt; "[c++] f = " &lt;&lt; f &lt;&lt; std::endl;
      std::cout &lt;&lt; "[c++] g = " &lt;&lt; g &lt;&lt; std::endl;
      printf("[c] f = %f\n", f);
      printf("[c] g = %f\n", g);
  
      return 0;
  
  }
  </code></pre>
  
  <p>The output I'm seeing is:</p>
  
  <pre><code>kiran@kiran-VirtualBox:~/test$ g++ -o test test.cpp 
  kiran@kiran-VirtualBox:~/test$ ./test 
  [c++] f = 735416
  [c++] g = 735417
  [c] f = 735416.416898
  [c] g = 735416.716898
  [c++] f = 735417
  [c++] g = 735417
  [c] f = 735416.516898
  [c] g = 735416.816898
  </code></pre>
  
  <p>Because the default precision is showing up as 6, shouldn't the cout also be showing the 6 decimal places?  </p>
  
  <p>If I do</p>
  
  <pre><code>std::cout &lt;&lt; std::fixed &lt;&lt; f
  </code></pre>
  
  <p>it prints properly (w/ all the decimal places).</p>
  
  <p>Just wondering if someone can explain this behavior to me?  Is it expected?  Am I expected to use std::fixed to force printing of doubles properly?</p>