![]() |
#2
eagleboycn2008-01-26 22:41
|
#include <iostream>
using namespace std;
int main()
{
float a=2.4;
cout <<"before showpoint,a="<<a<<endl; //output 2.4
ios_base ::fmtflags back=cout.setf(ios_base ::showpoint);
cout <<"after showpoint,a="<<a<<endl; //output 2.400000
cout.setf(back);
cout<<"after restore , a="<<a<<endl; //还是 2.400000
system ("pause");
return 0;
}
为什么执行了cout.setf(back);后还是输出2.400000?