Dev-c++编译时提示[Error] 'std::precision' has not been declared
#include<iomanip>
#include<ios>
#include<iostream>
#include<string>
using std::cin; using std::setprecision;
using std::cout; using std::string;
using std::endl; using std::streamsize;
using std::precision;
int main()
{
cout<<"please enter your first name: ";
string name;
cin>>name;
cout<<"hello, "+name+"! "<<endl;
cout<<"please enter your midterm and final grades: ";
double midterm,final;
cin>>midterm>>final;
cout<<"enter your all homework grades: ";
int count = 0;
double sum = 0;
double x;
while(cin>>x)
{
++count;
sum+=x;
}
streamsize prec = cout.precision();
cout<<"your final grade is "<<setprecision(3)<<0.2*midterm+0.4*final+0.4*sum/count<<setprecision(prec)<<endl;
return 0;
}
//本人菜鸟一枚,以上代码来自教科书,却无法在dev-cpp5.9.2上正常运行,请问是为什么?还请各路大神指点一二,感激不尽。
//以下为编译提示的错误
//9 12 C:\Users\11204\Desktop\cpp\3.1例子.cpp [Error] 'std::precision' has not been declared