Mitternachtsformelberechnung, was ist in meinem Quellcode falsch?
-
#include <iostream.h> #include <math.h> using namespace std; float a,b,c; float y, x; float x1,x2; main() { cout <<"Mitternachtsformel: \n"; cout <<"Bestimmung der Nullpunkte einer Parabel in der Normalform.\n"; cout <<"Geben sie a ein: \t"; cin>>a; cout <<"Geben sie b ein: \t"; cin>>b; cout <<"Geben sie c ein: \t"; cin>>c; double x = b*b-4*a*c; double y= sqrt(x); x1=(-b+y)/2*a; cout <<"x1 ist " << x1 << endl; getchar(); getchar(); return(0); }
Was ist hier falsch?
-
Du fängst den Fall x<0 nicht ab.
PS: Übrigens reicht ein Thread zu der Frage völlig aus
-
Danke jetzt klappt`s.