头文件:
函数:round()
格式:T round(T x)
#include<iostream>
#include<cmath>
using namespace std;
int main(){
cout<<"round(1.3) = "<<round(1.3)<<endl
<<"round(1.5) = "<<round(1.5)<<endl
<<"round(-1.3) = "<<round(-1.3)<<endl
<<"round(-1.5) = "<<round(-1.5)<<endl;
return 0;
}
输出:
1
2
-1
-2