输出结果保留几位小数 包含头文件 #include <iomanip> 输出代码 cout << fixed << showpoint << setprecision(1) << endl; //设置浮点数以固定的小数位数显示,这里设置保留一位小数 C++11