#include<iostream>
#include<cmath>
using namespace std;
int main()
{
double num = 8.6;
//ceil()返回的是double 类型的
cout << num << " 向上取整为: " << ceil(num) << endl;
cout << num << " 向下取整为: " << floor(num) << endl;
cout << num << " 四舍五入为: " << round(num) << endl;
return 0;
}
取整函数_
于 2022-03-21 22:40:24 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)