代码中简单实现四舍五入(加上0.5取整)适用于所有语言

int representGoal = (int) (graph.goal*representRatio+0.5);

只需要加0.5取整。

原文地址:https://www.cnblogs.com/cl1024cl/p/6205556.html