void cm_quad_gleichung(double a, double b, double c) {
if(a == 0)
std::cerr << "Keine quadratische Gleichung!\n";
else {
double d = b*b - 4*a*c;
if(d < 0)
std::cerr << "Keine Loesung! Diskriminante < 0\n";
else {
double x1 = (-b + sqrt(d)) / (2*a);
double x2 = (-b - sqrt(d)) / (2*a);
std::cout << "\nx1 = "<< x1 << "\nx2 = " << x2 << '\n';
}
}
}
|