#include <iostream>
#include <locale>
#include <cmath>
using namespace std;
int main()
{
setlocale(LC_ALL, ""
![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
;
cout << "Решение квадратного уравнения через теорему Виетта" << endl;
double a, b, c;
a = 1;
cout << "Введите b: ";
cin >> b;
cout << "Введите c: ";
cin >> c;
double d = b*b - 4*a*c;
if (d < 0) {
cout << "Корней не имеет." << endl;
return 0;
}
if (d == 0) {
cout << "Имеет 1 корень." << endl;
double x = -b/(a+a);
cout << "x = " << x << endl;
}
else {
cout << "Имеет 2 корня." << endl;
double x1 = (-b - sqrt(d)) / (a+a);
cout << "x1 = " << x1 << endl;
double x2 = (-b + sqrt(d)) / (a+a);
cout << "x2 = " << x2 << endl;
}
return 0;
}