#include <iostream>
#include <cmath>
using namespace std;

int main() {
    double a, b, c;

    cout << "Enter a: ";
    if (!(cin >> a)) { cout << "Invalid input!"; return 1; }
    cout << "Enter b: ";
    if (!(cin >> b)) { cout << "Invalid input!"; return 1; }
    cout << "Enter c: ";
    if (!(cin >> c)) { cout << "Invalid input!"; return 1; }

    if (a == 0) {
        cout << "a cannot be zero for a quadratic equation." << endl;
        return 1;
    }

    double discriminant = b*b - 4*a*c;

    if (discriminant > 0) {
        double x1 = (-b + sqrt(discriminant)) / (2*a);
        double x2 = (-b - sqrt(discriminant)) / (2*a);
        cout << "Two real solutions: x1 = " << x1 << ", x2 = " << x2 << endl;
    } 
    else if (discriminant == 0) {
        double x = -b / (2*a);
        cout << "One real solution: x = " << x << endl;
    } 
    else {
        cout << "No real solutions (complex roots)." << endl;
    }

    return 0;
}
