Ecuaciones de Segundo Grado
Las ecuaciones de segundo grado incompletas son de tres tipos:
A. ax2 = 0; si b = 0 y c = 0. (Incompleta Pura)
B. ax2 + bx = 0; si c = 0. (Incompleta Binomio)
C. ax2 + c = 0; si b = 0. (Incompleta Pura)
Ejemplos
Solución:
Solución:
Solución:
Codigo Fuente C++
#include <iostream>
using namespace std;
#include <cstdlib>
#include <ctime>
#include <cstdlib>
#include <string>
#include <algorithm>
using namespace std;
#include <math.h>
#include <iostream>
using namespace std;
# define a 3
# define b 0
# define c -300
int segundo_grado()
{
//int a,b,c,
int d;
float x,y;
cout<<"\n";
//a=2;
cout<<"\t\ta="<<a;
while (a == 0) {
printf("Ingrese coeficiente a: ");}
// a=2;}
//}
cout<<"\tb="<<b;
//b=4;
//printf("\tc:");
cout<<"\tc="<<c;
//c=0;
d = b*b-4*a*c;
cout<<"\n\tSolucion:";
cout<<"\n\t";
if (d > 0) {
x = (-b+sqrt(d))/(2*a);
y = (-b-sqrt(d))/(2*a);
printf("x1 = %.2f",x);
cout<<"\t";
printf("x2 = %.2f",y);
}
else if (d == 0) {
x = (-b)/(2*a);
printf("x1 = %.2f\t\t",x);
}
else
printf("La ecuacion no tiene solucion");
return 0;
}
int main(){
string primer_grado[20][20]={{"2x²+3x=-5x"},{"7x²-x=2x-x²"},{"3x-6x²=2x²-5x"},{"2x²+3x=-5x"},{"4x²=x"},{"3x²-27=0"},{"(2x²-5)=3(2-3x²)"},{"x²+(x+2)²=580"},{"x²-5x-84=0"},{"4x²-6x+2=0"},{"x²-5x+6=0"},{"-x²+7x+3=0"},{"2x²-7x+3=0"},{"x²-2x+1=0"}};
string primer_grado2[20][20]={{"6x²-5x+1=0"},{"18=6x+x(x-13)"},{"-x²+4x-7=0"},{"7x²+21x-28=0"},{"x²+(7-x)²=25"},{"2x-3=1-2x+x²"},{"x²+x+1=0"},{"x²-144=0"},{"9x²-1=0"},{"x(x+5)=0"},{"5x(x-18)=0"}};
string primer_grado3[20][20]={{"2x²+4x=0"},{"-3x²+2x=0"},{"x²-x=0"},{"3x²-27=0"},{"3x²+27=0"},{"-25x²+4=0"},{"x²-4x+3=0"},{"6x²-x-1=0"},{"2x²-3x+3=0"},{"3x²+12=312"},{"x²-9x+14=0"}};
int i,n,jj,n2,j,n3,k;
srand(time(NULL));
n=(1+rand()%(12+1));
cout<<"\tECUACIONES DE SEGUNDO GRADO\tEjemplos:\t"<<primer_grado[n][jj];
n2=(1+rand()%(9+1));
cout<<"\n\t\tf(x)=ax²+bx+c \t\t\t"<<primer_grado2[n2][j];
n3=(1+rand()%(9+1));
cout<<"\n\t\t\t\t\t\t\t"<<primer_grado3[n3][k];
segundo_grado();
cout<<"\n * y * ";
cout<<"\n * | * ";
cout<<"\n * | * ";
cout<<"\n * ³| *";
cout<<"\n * | *";
cout<<"\n * ²| *";
cout<<"\n * | *";
cout<<"\n * ¹| *";
cout<<"\n -x___________________|___________________x";
cout<<"\n ³ ² ¹ ° ¹ ² ³ ";
cout<<"\n ¹| ";
cout<<"\n | ";
cout<<"\n ²| ";
cout<<"\n | ";
cout<<"\n ³|";
cout<<"\n | ";
cout<<"\n -y ";
}
No hay comentarios:
Publicar un comentario