题目链接
难度:入门
题解
round(x)函数 返回对x进行四舍五入后的结果,返回值为浮点型。
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double x;
cin >> x;
cout << round(x);
return 0;
}
本文介绍了C++中round函数的基本用法,它用于对输入的浮点数进行四舍五入并返回结果,通过实例展示了在`<iostream>`和`<cmath>`库中的应用。
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double x;
cin >> x;
cout << round(x);
return 0;
}
407

被折叠的 条评论
为什么被折叠?