Skip to content
Snippets Groups Projects
Commit 16d266c9 authored by Pirahalathan Premachandran's avatar Pirahalathan Premachandran
Browse files

Aufgabe 3.2 Verbesserung

parent fc5db8f5
No related branches found
No related tags found
No related merge requests found
......@@ -14,12 +14,15 @@ cin >> b;
cout << "Geben sie c ein" << endl;
cin >> c;
if (pow(b,2)-4*a*c < 0) {
int d = (pow(b,2)-4*a*c);
cout << "Diskriminante = " << d << endl;
if (d < 0) {
cout << "keine Lösung" << endl;
} else if (pow(b,2)-4*a*c == 0) {
} else if (d == 0) {
cout << "Eine Lösung X = " << (-b)/(2*a) << endl;
} else {
cout << "Zwei Lösungen X = " << (-b+sqrt(pow(b,2)-4*a*c))/(2*a) << " oder X = " << (-b-sqrt(pow(b,2)-4*a*c))/(2*a) << endl;
cout << "Zwei Lösungen X = " << (-b+sqrt(d))/(2*a) << " oder X = " << (-b-sqrt(d))/(2*a) << endl;
}
return 0;
}
\ No newline at end of file
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment