#include<iomanip>
iomanip这个头文件中,io代表输入输出,manip是manipulator(操纵器)的缩写(在c++上只能通过输入缩写才有效。)
作用:
主要是对cin,cout之类的一些操纵运算子。
它是I/O流控制头文件,就像C里面的格式化输出一样.
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
double s;
cin>>s;
cout<<fixed<<setprecision(3)<<s<<endl;
}
//fixed要和setprecision一起用才有效,无先后顺序。(要有头文件iomanip才能用)
//作用效果是限制显示浮点数s小数点后三位。