我没有找到解决方案,在小数点前没有'0'的情况下写十进制数低于1.我希望以这种格式显示数字:".1",".2"等...
使用:
std::cout << std::setw(2) << std::setprecision(1) << std::fixed << number;
总是给我"0.1","0.2"等格式......
我错了什么?谢谢你的帮助
c++ decimal number-formatting
c++ ×1
decimal ×1
number-formatting ×1