ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1001. Reverse Root

What's wrong in my code?
Posted by SERGEI_KOM 2 Aug 2007 01:23

#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?
Posted by zeinalkhani 7 Nov 2007 12:12
pay attention to start point of loop:
    for(int c=b-1;c>=0;c--)

and set precision of cout:
    cout.precision(4);