头文件是iomanip

cout<<setiosflags(ios::fixed)<<setprecision(1)<<1.2345<<endl;

//输出1.2;