    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:
    13:    if (cin.fail())
    14:    {
    15:       cout << "Error: Bad input\n";
    16:       return 1;
    17:    }
    18:
    19:    if (area < 0)
    20:    {
    21:       cout << "Error: Negative area.\n";
    22:       return 1;
    23:    }
    24:
    25:    cout << "The side length is " << sqrt(area) << "\n";
    26:
    27:    return 0;
    28: }