c++怎么保留小数位数

286 阅读1分钟

#include
//保留小数点后n位
cout << setiosflags(ios::fixed) << setprecision(n)
//保留n位有效数字
cout << setprecision(n)