需要包含的头文件
#include <iomanip>
Program: Result:
Summary:
setprecision(n)设置精度为n,
当没有设置fixed时,这个数的精度为n,设置fixed时,小数点后的数字精度为n,小数点前没有限制。
关于输出的精度控制见《C++ Primer(3rd edition)》chapter20- iostream library
博客园 © 2004-2025 浙公网安备 33010602011771号 浙ICP备2021040463号-3