title: Displaying rounded off values instead of exact value in decimal in C++
body: <p>I'm using MS Visual C++ 6.0 (as my work requires) on a pretty decent Windows 10 PC.</p>
  <p>I'm having trouble with displaying the value after the decimal that is entered manually via &quot;cin &gt;&gt;&quot;, I've tried the fix that was answered thru DSKVP's question (<a href="https://stackoverflow.com/questions/16280069/show-two-digits-after-decimal-point-in-c">Show two digits after decimal point in c++</a>) but it still won't show the decimal values, it just drops the digits after the decimal and/or rounds them off.</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;iomanip&gt;    //for setprecision and fixed
  using namespace std;  
  
  int readResults()
  {
      cout &lt;&lt; setprecision(2);
      cout &lt;&lt; &quot;Scanned Value: &quot;;
      double vrrm(0.0);
      cin &gt;&gt; vrrm;
      return vrrm;
  }
  
  int main()
  {
      double vrrm ( readResults() );
      double vrwm ( readResults() );
      double vr   ( readResults() );
      double vrms ( readResults() );
      double io   ( readResults() );
      double vfm  ( readResults() );
  
      cout &lt;&lt; &quot;\nParameters \tScanned Values  \t Limits \t\tUnit&quot; &lt;&lt; endl;
      cout &lt;&lt; &quot;Vrmm \t \t&quot; &lt;&lt; fixed &lt;&lt; setprecision (2) &lt;&lt; vrrm &lt;&lt; &quot; \t\t\t 45.00 - 50.00 \t\tV&quot; &lt;&lt; endl;
      cout &lt;&lt; &quot;Vrwm \t \t&quot; &lt;&lt; fixed &lt;&lt; setprecision (2) &lt;&lt; vrwm &lt;&lt; &quot; \t\t\t 45.00 - 50.00 \t\tV&quot; &lt;&lt; endl;
      cout &lt;&lt; &quot;Vr \t \t&quot;   &lt;&lt; fixed &lt;&lt; setprecision (2) &lt;&lt; vr   &lt;&lt; &quot; \t\t\t 45.00 - 50.00 \t\tV&quot; &lt;&lt; endl;
      cout &lt;&lt; &quot;Vrms \t \t&quot; &lt;&lt; fixed &lt;&lt; setprecision (2) &lt;&lt; vrms &lt;&lt; &quot; \t\t\t 33.00 - 37.00 \t\tV&quot; &lt;&lt; endl;             
      cout &lt;&lt; &quot;Io \t \t&quot;   &lt;&lt; fixed &lt;&lt; setprecision (2) &lt;&lt; io   &lt;&lt; &quot; \t\t\t 00.90 - 1.50  \t\tA&quot; &lt;&lt; endl;
      cout &lt;&lt; &quot;Vfm \t \t&quot;  &lt;&lt; fixed &lt;&lt; setprecision (2) &lt;&lt; vfm  &lt;&lt; &quot; \t\t\t 00.95 - 1.05  \t\tV&quot; &lt;&lt; endl;
      cout &lt;&lt; endl;
      
      if ( vrrm &gt;= 45.00  &amp;&amp;  vrrm &lt;= 50.00  &amp;&amp;
           vrwm &gt;= 45.00  &amp;&amp;  vrwm &lt;= 50.00  &amp;&amp;
           vr &gt;= 45.00    &amp;&amp;  vr &lt;= 50.00    &amp;&amp;
           vrms &gt;= 33.00  &amp;&amp;  vrms &lt;= 37.00  &amp;&amp; 
           io &gt;= 0.90     &amp;&amp;  io &lt;= 1.50     &amp;&amp;
           vfm &gt;= 0.95    &amp;&amp;  vfm &lt;= 1.05       )
          
          cout &lt;&lt; &quot;PASS&quot; &lt;&lt; endl &lt;&lt; endl;
          
      else
          cout &lt;&lt; &quot;FAIL&quot; &lt;&lt; endl &lt;&lt; endl;
                                                                                                                                                                                                                                                                                                                                                                                                                                                    
      return 0;
  }
  </code></pre>
  <p>When I input decimal values, this is the result:</p>
  <pre><code>Scanned Value: 49.98
  Scanned Value: 49.99
  Scanned Value: 49.85
  Scanned Value: 35.01
  Scanned Value: 0.99
  Scanned Value: 1.01
  
  Parameters      Scanned Values           Limits                 Unit
  Vrmm            49.00                    45.00 - 50.00          V
  Vrwm            49.00                    45.00 - 50.00          V
  Vr              49.00                    45.00 - 50.00          V
  Vrms            35.00                    33.00 - 37.00          V
  Io              0.00                     00.90 - 1.50           A
  Vfm             1.00                     00.95 - 1.05           V
  
  FAIL
  
  Press any key to continue
  </code></pre>
  <p>I tried initializing Vrrm to 0.0 (as seen here) and even tried to multiply it by 1.00 as seen on <a href="https://stackoverflow.com/questions/17091517/cant-get-cout-to-display-decimals-c">Can&#39;t get cout to display decimals c++</a> but I believe it does not apply to what I am writing here - still wouldn't display the values after the decimal point.</p>
  <p><strong>I very much want to have the complete value displayed and the program to properly output PASS (as it should be). Do anyone of you mind to kindly explain it to me where I went wrong/refer me to some good reference/source materials?</strong></p>
  <p>I just started learning C++ this week and Alex's tutorial is doing an <em>awesome</em> job educating me and his work is my reference for now: <a href="https://www.learncpp.com/" rel="nofollow noreferrer">https://www.learncpp.com/</a>.</p>