【C++】输出格式

输出总数位控制

输出xxxxx格式

//头文件
#include<iomanip>
cout<<setprecision(5)<<number<<endl;

输出小数位控制

输出xx.xxxxx格式,使用fixed

//头文件
#include<iomanip>
cout<<fixed<<setprecision(5)<<number<<endl;

猜你喜欢

转载自blog.csdn.net/helloworld0529/article/details/107605631