|
|
back to boardcan anyone tell me why WA?(C++) #include <iostream> #include<vector> #include<iomanip> #include <math.h> using namespace std; int main() { double a; vector<double> vd; while(cin>>a) { vd.push_back(a); } cout.setf(cout.showpoint); setprecision(4); setiosflags(ios::fixed); for(vector<double>::size_type i=vd.size()-1;i!=-1;--i) { cout<<pow(vd[i],0.5)<<endl; } return 0; } Re: can anyone tell me why WA?(C++) setprecision and setiosflags didn't have any effect in your code. You need to put them in some 'cout << ' line. Re: can anyone tell me why WA?(C++) Try to change these lines cout.setf(cout.showpoint); setprecision(4); setiosflags(ios::fixed); to cout.setf(ios::fixed); cout.precision(4); |
|
|