Lenguaje de programacion visual basic: como resolver ecuaciones cuadraticas programa hecho
luis danco razuri carreraPráctica o problema8 de Abril de 2019
3.763 Palabras (16 Páginas)150 Visitas
// resolver ecuacion cuadratica
#include
#include
using namespace std;
float raiz_real(float a, float b, float c)
{
float x;
x = (-b + sqrt(b*b - 4.0*a*c)) / (2.0*a);
return x;
}
void impresion(float& x, float& y)
{
cout << x << endl;
cout << y << endl;
}
int main()
{
float a, b, c, a1, a2, r1, r2, i1, i2, i3;
//float a, b;
//float c;
cout << "La ecuacion es de la formas: f(x) = ax^2 + bx + c" << endl;
cout << "Ingrese el valor para a: " << endl;
cin >> a;
cout << " " << endl;
cout << "Ingrese el valor para b: " << endl;
cin >> b;
cout << " " << endl;
cout << "Ingrese el valor para c: " << endl;
cin >> c;
cout << " " << endl;
cout << "Ingrese primer valor del intervalo " << endl;
cin >> a1;
cout << " " << endl;
cout << "Ingrese segundo valor del intervalo " << endl;
cin >> a2;
cout << " " << endl;
r1 = (-b - sqrt(b*b - 4.0*a*c)) / (2.0*a);
r2 = (-b + sqrt(b*b - 4.0*a*c)) / (2.0*a);
if ((r1 >= a1) && (r1 <= a2) && (r2 >= a1) && (r2 <= a2))
cout << "Las raices són: " << endl;
else
cout << "La raiz es:" << endl;
if ((r1 >= a1) && (r1 <= a2) && (r2 >= a1) && (r2 <= a2))
cout << r1 << " " << r2 << endl;
else
if ((r1 >= a1) && (r1 <= a2))
cout << r1 << endl;
else
if ((r2 >= a1) && (r2 <= a2))
cout << r2 << endl;
else
cout << "Sus raices no estan en el intervalo" << endl;
//hacer la integral con la ecuacion x´2-2x-2=0
cout << " " << endl;
cout << "Muestra de las raices obtenidas de la ecuacion: " << endl;
cout << r1 << endl;
cout << r2 << endl;
cout << " " << endl;
cout << "Hallando la integral de la ecuacion " << endl;
i1 = a / 3;
i2 = b / 2;
i3 = c * 1;
if ((b>0) && (c>0))
cout << i1 << "(x^3)" << "+" << i2 << "(x^2)" << "+" << i3 << "(x)" << endl;
...