#include <iostream>
#include <iomanip>
using namespace std;
/*对比A1和A2、B1和B2、C1和C2的输出结果,观察出“fixed”和“setprecision(int x)”的用法*/
/*“fixed”和“setprecision(int x)”用一次,对下面的程序都起作用*/
int main()
{
const double PI=3.1415926;
cout<<PI<<endl;
//cout<<fixed<<setprecision(3)<<PI<<endl;//A1
cout<<setprecision(3)<<PI<<endl;//A2
cout<<fixed<<setprecision(5)<<PI<<endl;//B1
cout<<setprecision(5)<<PI<<endl;//B2
//cout<<fixed<<setprecision(10)<<PI<<endl;//C1
cout<<setprecision(10)<<PI<<endl;//C2
system("pause");
return 0;
}