|
|
back to boardWhat's wrong in my code? #include <iostream> #include <cmath> #include <iomanip> using namespace std; int main() { const int U=100000; double A[U]={0}; int b=0;
while(cin>>A[b]) b++; for(int c=U-1;c>=0;c--) {
{double root2 = sqrt( A[c] ); cout.setf( std::ios::fixed,std:: ios::floatfield ); cout<<root2; cout<<"\n"; } } return 0; } Re: What's wrong in my code? pay attention to start point of loop: for(int c=b-1;c>=0;c--) and set precision of cout: cout.precision(4); |
|
|