c语言round() 函数

C99标准中有round()函数,声明为:
double round(double );

返回距离参数最近的整数,如果参数值正好在两个整数的中间位置,则返回距离0较远的那一个整数(即正数则返回大于参数的整数,负数则返回小于参数的整数)

 

 

round was added to C in the C99 standard. Microsoft still hasn't finished putting support for C99 in the compiler and round isn't in there yet.
你的目的就是想得到四舍五入后的数,而VC不支持round,可改用floor(x+0.5)函数

你可能感兴趣的:(C/C++Function)