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