ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Formula Cuadratica

edwarock7 de Noviembre de 2012

899 Palabras (4 Páginas)341 Visitas

Página 1 de 4

#include <iostream>

#include <math.h>

using namespace std;

int main ()

{

float a,b,c;

system("color 5f");

cout<<"\n\n\t ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»";

cout<<"\n\t º la ecuacion es de la formas: f(x) = ax^2 + bx + c º";

cout<<"\n\t ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ";

while (true)

{

cout <<"\n\t Ingrese el valor de a: ";

if (scanf ("%f", &a))

{

break;

}

fflush (stdin);

printf ("\n\t Digito una letra...");

printf ("\n\t Ingrese un NUMERO POR FAVOR...\n\t ");

system ("PAUSE");

}

while (true)

{

cout <<"\t Ingrese el valor de b: ";

if (scanf ("%f", &b))

{

break;

}

fflush (stdin);

printf ("\n\t Digito una letra...");

printf ("\n\t Ingrese un NUMERO POR FAVOR...\n\t ");

system ("PAUSE");

}

while (true)

{

cout <<"\t Ingrese el valor de c: ";

if (scanf ("%f", &c))

{

break;

}

fflush (stdin);

printf ("\n\t Digito una letra...");

printf ("\n\t Ingrese un NUMERO POR FAVOR...\n\t ");

system ("PAUSE");

}

system ("cls");

system ("color d5");

cout<<"\n\n\t ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»";

cout<<"\n\t º El resultado de la ecuacion cuadratica es: º";

cout<<"\n\t ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ";

if (a==0) cout<<"\n\t Error, divicion entre cero"<<endl;

{

if(((b*b)- (4.0*a*c)) >= 0.0)

{

float x1,x2;

cout << "\n\t las raices de la f(x) son reales: " << endl;

x1 = (-b + sqrt(b*b - 4.0*a*c))/(2.0*a);

x2 = (-b - sqrt(b*b - 4.0*a*c))/(2.0*a);

cout << "\n\t x1: " << x1 << endl;

cout << "\n\t x2: " << x2 << endl;

}

else{

float im_x1, im_x2;

float re_x1, re_x2;

cout << "\n\t Ddted tiene muchisima imaginaci\'on " << endl;

cout << " \n\t .. imaginacion es mas que el conocimiento";

cout << "\n\t Albert Einstein \n";

cout << "\n\t las raices de la f(x) son imaginarias:\n";

re_x1 = -b/(2.0*a);

re_x2 = -b/(2.0*a);

im_x1 = sqrt(-b*b + 4.0*a*c);

im_x2 = sqrt(-b*b + 4.0*a*c);

cout << "\n\t x1: " << re_x1

...

Descargar como (para miembros actualizados) txt (3 Kb)
Leer 3 páginas más »
Disponible sólo en Clubensayos.com