阿迪达斯的总部在哪里:C++基本问题

来源:百度文库 编辑:高考问答 时间:2024/05/14 17:48:41
一个float数 只要显示小数点后一位在C++中应该怎么办 求语句

#include<iostream>
#include<iomanip>
using namespace std;
void main()
{
float f; //f为你要填的数字或除数
cout<<setiosflags(ios::fixed);
cout<<setprecision(1)<<f<<endl;
}