#include <iostream>
#include <cmath>

int check_number(std::string number, double* checked_number) {
    std::size_t pos;
    *checked_number = std::stoi(number, &pos); // how to properly type check?
    return 0;
}

int main(int argc, char *argv[]) {
    if (argc < 4) {
        std::cout << "No/Not enough parameters given." << std::endl;
        return -1;
    }
    double a, b, c;
    int check = check_number(argv[1], &a) & check_number(argv[2], &b) & check_number(argv[3], &c);
    if (check < 0) {
        std::cout << "Something went wrong. :/" << std::endl;
        return check;
    }
    double d = b*b - 4*a*c;
    
    if (d < 0) {
        std::cout << "No real solutions." << std::endl;
        return 0;
    }
    
    double x_1 = (-b + sqrt(d))/(2*a);
    double x_2 = (-b - sqrt(d))/(2*a);
    
    if (x_1 == x_2)
        std::cout << "Double zero at x = " << x_1 << std::endl;
    else
        std::cout << "Zeroes found at x_1 = " << x_1 << " and x_2 = " << x_2 << std::endl;
    
    return 0;
}
