Reg*_*ald 6 c++ numbers decimal
如何让我的程序输出一个至少有一个数字在C++后面的数字?输出:1 = 1.0或1.25 = 1.25或2.2 = 2.2或3.456789 = 3.456789
提前致谢
使用showpoint
强制小数点要打印
double x = 1.0;
std::cout << std::showpoint << x << "\n";
Run Code Online (Sandbox Code Playgroud)
后面将是0
满足流精度所需的数量。