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

Username:   Password: 
 RegisterRegister   
 HOw to round decimal points.
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
DaveAngus




PostPosted: Tue Apr 01, 2008 9:14 am   Post subject: HOw to round decimal points.

Hey guys.
This is such a noob question but it is one of those things I have never bothered learning because you dont think much about it.
HOw do you round dcecimals?
I have this proceduare that when it calculates the answer it NORMALLY comes out like a HUGE decimal.
If you could let me know how to round it to one decimal point,
that would be great!

Thanks a lot,
-Dave
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Apr 01, 2008 9:41 am   Post subject: RE:HOw to round decimal points.

rounding to closest integer is done with round(). To save that one (or any number really) decimal point beyond the integer "cutoff", think powers of 10
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
DaveAngus




PostPosted: Tue Apr 01, 2008 10:03 am   Post subject: RE:HOw to round decimal points.

Thanks a lot Tony for the help!
Doug101




PostPosted: Tue Apr 01, 2008 10:41 am   Post subject: Re: HOw to round decimal points.

k all you need to do is use the round comand.

eg.

round(variable)
DaveAngus




PostPosted: Wed Apr 02, 2008 10:40 am   Post subject: RE:HOw to round decimal points.

doug...again, Tony helped me.
Therefor I dont need your help
you just copied what he said.
Again, my threads arent for you to boost your posts
Doug101




PostPosted: Wed Apr 02, 2008 10:42 am   Post subject: Re: HOw to round decimal points.

sry i didnt read his.
DaveAngus




PostPosted: Wed Apr 02, 2008 10:43 am   Post subject: RE:HOw to round decimal points.

read all posts before you reply
Doug101




PostPosted: Wed Apr 02, 2008 10:44 am   Post subject: Re: HOw to round decimal points.

sry i didnt really feal like reading them .
Sponsor
Sponsor
Sponsor
sponsor
DaveAngus




PostPosted: Wed Apr 02, 2008 10:46 am   Post subject: RE:HOw to round decimal points.

then dont post
Tony




PostPosted: Wed Apr 02, 2008 10:53 am   Post subject: RE:HOw to round decimal points.

DaveAngus has an excellent point there. Saying random stuff without reading the thread is a quick way to get banned.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 10 Posts ]
Jump to:   


Style:  
Search: