Реализовать программу исследования квадратного уравнения .
Коэффициенты a, b и c вводятся с клавиатуры
на языке си++
Ответы на вопрос
Ответил Pashq4
0
#include <iostream.h>
#include <math.h>
int main()
{
int a, b, c;
long long d;
cout << "Vvedite a: "; cin >> a;
cout << "nVvedite b: "; cin >> b;
cout << "nVvedite c: "; cin >> c;
d = b * b - 4 *a * c;
if (d > 0) cout << "x1 = " << (-b + sqrt(d))/(2*a) << "n" << "x2 = " << (-b - sqrt(d))/(2*a) << endl;
else if (d == 0) cout << "x = " << -1.*b/(2*a) << endl;
else if (d < 0) cout << "Korney net" << endl;
system("pause");
return 0;
}
#include <math.h>
int main()
{
int a, b, c;
long long d;
cout << "Vvedite a: "; cin >> a;
cout << "nVvedite b: "; cin >> b;
cout << "nVvedite c: "; cin >> c;
d = b * b - 4 *a * c;
if (d > 0) cout << "x1 = " << (-b + sqrt(d))/(2*a) << "n" << "x2 = " << (-b - sqrt(d))/(2*a) << endl;
else if (d == 0) cout << "x = " << -1.*b/(2*a) << endl;
else if (d < 0) cout << "Korney net" << endl;
system("pause");
return 0;
}
Новые вопросы