01: #include <iostream>
02: #include <cmath>
03: using namespace std;
04: 
05: int main()
06: {  double area;
07:    cout << "Please enter the area of a square: ";
08:    cin >> area;
09: 
10:    if (cin.fail())
11:    {  cout << "Error: Bad input\n";
12:       return 1;
13:    }
14: 
15:    if (area < 0)
16:    {  cout << "Error: Negative area.\n";
17:       return 1;
18:    }
19: 
20:    cout << "The side length is " << sqrt(area) << "\n";
21:    return 0;
22: }