Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to know is there any function in c++ to round a number???
Posted

Best Solution--

Let Me Google[^]
 
Share this answer
 
Comments
CPallini 7-May-11 8:29am    
I agree: 5.
Emilio Garavaglia 7-May-11 9:17am    
gosh ... after few days, one of the result is this
NuttingCDEF 7-May-11 9:43am    
Genius! My 5.
Legor 9-May-11 4:11am    
Thanks, never would have thought of that!
Most Inquirers who asked about rounding do not actually need rounding. It's almost never needed. Most likely, you need a rounded string presentation of the number in your UI or console. This is completely different thing.
If this is what you really need, never use rounding.

See: http://www.cplusplus.com/reference/clibrary/cstdio/printf/[^], http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900