//Programa para resolver ecuaciones cuadraticas con numeros reales
//Autor: Anderson Ponciano
//Fecha: 23/03/2020
#include <iostream>
#include <cmatch>
using namespace std;
main()
{
float a,b,c,d,x,y;
cout << "ingrese a:";
cin >> a;
cout << "ingrese b:";
cin >> b;
cout << "ingrese c:";
cin >> c;
if (a == 0)
cout << "no cumple la condición."<<"\n";
else
{
d = (b*b) - (4*a*c);
if (d == 0)
{
x = (-b/2*a);
y = x;
}
else
if (d>0)
{
x = (-b) + sqrt(d)/(2*a);
y = (-b) - sqrt(d)/(2*a);
cout << x << "\n";
cout << y << "\n";
}
else
cout << "es raiz imaginaria"<<"\n";
}
return system("PAUSE");
}
To embed this project on your website, copy the following code and paste it into your website's HTML: