Board index » cppbuilder » Re: Rounding a number

Re: Rounding a number


2007-04-03 10:35:06 PM
cppbuilder61
I am trying to Round a number to an integer using C++ Builder. For
example when I type into the TEdit box the number 17.85. I would like
it to be 18.00.
Anybody can help me.
Thanks
 
 

Re:Re: Rounding a number

Simple as this:
int roundedNumber = (int) (numberYouWantToRound + 0.5);
Good luck !!!