ALEC
2012-10-07 09:00:40 UTC
In order to receive credit, you must use a do-while loop to process the input.
I got the correct output, but I keep getting the "nan" error message and I need help fixing this.
Here is my solution:
#include
#include
#include
using namespace std;
int main()
{
double x;
double y = 0;
do
{
cin >> x;
if (x < 0)
{
cout << "Bye!" << endl;
}
y = sqrt(x);
cout << setprecision(2) << fixed << y << endl;
}
while(x > 0);
return 0;
}