四舍五入数字. [英] Rounding the Number.
本文介绍了四舍五入数字.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道c ++中是否有任何函数可以舍入一个数字?
I want to know is there any function in c++ to round a number???
推荐答案
最佳解决方案-
Let Me Google [
Best Solution--
Let Me Google[^]
大多数询问四舍五入的查询者实际上并不需要四舍五入.几乎不需要.最有可能的是,您需要在UI或控制台中四舍五入的数字表示形式.这是完全不同的事情.
如果这是您真正需要的,请不要使用舍入.
请参阅: http://www.cplusplus.com/reference/clibrary/cstdio/printf/ [ ^ ],http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/ [
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
这篇关于四舍五入数字.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文