C语言中用一个 round()函数可以进行四舍五入
round(double),需要传入double类型参数。然后再用 NSInteger去接收就可以了。
NSInteger rating = round(11.0 / 2.0);
输出结果为 6
C语言中用一个 round()函数可以进行四舍五入
round(double),需要传入double类型参数。然后再用 NSInteger去接收就可以了。
NSInteger rating = round(11.0 / 2.0);
输出结果为 6