Menu

I am new !!!! Decimals problem

2002-12-02
2012-09-26
  • Nobody/Anonymous

    I am a student and I have to finish my work but i cant set the program to show me only 3 decimal not 1.000000000000E+0.1 please let me know how it works.
    Thanks
    <b>Matias</b>

     
    • Curtis Sutter

      Curtis Sutter - 2002-12-02

      Add these lines before your cout statement that has that number in it.

      cout.setf(ios::fixed);
      cout.precesion(3);

      Curtis

       
    • Nobody/Anonymous

      I have and doesn't work!!!
      program Natura;
      var co: array [1..100] of integer;
      pre: array [1..100] of real; Here i want only 3 decimal, where I have to puta that????
      Thanks again and excuse my ignorance.

       
    • Curtis Sutter

      Curtis Sutter - 2002-12-02

      Dan's solution should work http://sourceforge.net/forum/message.php?msg_id=1777686 mine will as well, but i think he expressed his better.  If you want me to show you where to put my extra code, I will have to see all of yours.

      Curtis

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.