double输出

c++中控制double类型变量小数点后0的个数为2

#include<iomanip>

cout<<setprecision(2)<<setiosflags(ios::fixed)<<num<<endl;

你可能感兴趣的:(C++,C++)