需要包含的头文件
#include <iomanip>
Program: Result:
Summary:
setprecision(n)设置精度为n,
当没有设置fixed时,这个数的精度为n,设置fixed时,小数点后的数字精度为n,小数点前没有限制。
关于输出的精度控制见《C++ Primer(3rd edition)》chapter20- iostream library
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。