Х
Size: a a a
AP
AP
AP
AP
Х
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
float res1, res2, des;
if (a == 0) {
a = a + 1;
cout << "прибавил к А единицу\n";
}
if (b == 0)
{
b = b + 1;
cout << "прибавил к B единицу\n";
}
if (c == 0)
{
c = c + 1;
cout << "прибавил к C единицу\n";
}
des = (b*b) - (4*a*c);
if (des >= 0)
{
cout << "DES больше или равен 0\n";
if (des == 0)
{
cout << "DES равен 0\n";
res1 = (-b) / (2 * a);
res2 = (-b) / (2 * a);
cout << res1;
}
else
{
cout << "DES не равен 0 \n";
res1 = (-b) + sqrt(des) / (2 * a);
res2 = (-b) - sqrt(des) / (2 * a);
cout << res1 << " " << res2;
}
}
if (des < 0)
cout << "des меньше 0";
return 0;
}