(C++)setprecision与fixed控制精度

#include
#include
using namespace std;

int main()
{
    double n=0.0;
    n=7.0/4.0;
    cout<

输出结果:

1.75
1.750


setprecision与fixed 的直接连用可以直接控制小数的精确度

而其中   使用setprecision(n)可控制输出流显示浮点数的数字个数。

cout<

你可能感兴趣的:(函数收集(C++))