Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How to show only 2 decimals?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Luffy123




PostPosted: Wed May 23, 2012 10:16 pm   Post subject: How to show only 2 decimals?

Say I have a number

12.99728313

How do I make it show only 12.99

or

12.997

or just 12.9?
Sponsor
Sponsor
Sponsor
sponsor
Dreadnought




PostPosted: Wed May 23, 2012 10:42 pm   Post subject: Re: How to show only 2 decimals?

Read the documentation for put. Specifically, look at the use of : to format real numbers.

If you wish to convert the number to a string, you can read up about frealstr and erealstr
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: