轉載:https://blog.csdn.net/u014485485/article/details/78939537
今天,在vs2010里使用round()函數進行四舍五入,添加了#include <math.h>頭文件,還報錯:
“round”: 找不到標識符。
進math.h文件查看,原來vs2010的math里沒有round,ceil()和floor()都有:
要使用的話,自己添加一個:
double round(double r){ return (r > 0.0) ? floor(r + 0.5) : ceil(r - 0.5);}