求问大神setprecision操纵符是咋回事啊?为啥结果是这样的?
#include<iostream.h>#include<iomanip.h>
void main()
{
double d=123.456789;
cout <<d<<endl;
cout <<setprecision(7)<<d<<endl;
cout <<setprecision(8)<<d<<endl;
cout <<setprecision(9)<<d<<endl;
}
运行结果:
123.457
123.4568
123.45679
123.456789
Press any key to continue