Ayuda urgente
nose si me pueden ayudar con un programa en c++ Eliminacíon gaussiana con pivote parcial pofavor ya que me urge mucho si se los agradecere infinitamente gracais
// aqui esta tu programa resuleve un sistema de ecuaciones
// con el metodo gauss jordan
// paso a paso
// te muestra todas las operaciones de renglon
/ espero que te sirva
#include <stdio.h>
#include <string.h>
#include <conio.h>
#include <iostream.h>
#include <stdlib.h>
#include <ctype.h>
const max = 15;
typedef float matriz[max][max];
int n;
matriz mat;
char op;
void ingreso()
{
clrscr();
printf("Eliminacion Gauss Jordann");
printf("n ? ");
scanf("%d",&n);
clrscr();
textcolor(RED);
for (int x=0;x<n ;x++)
{
for (int y=0;y<= n;y++)
{
if (y != n)
{
gotoxy(7+7*y,3+x);
printf("%c",(108+y));
}
else
printf(" =");
}
}
textcolor(WHITE);
for (x=0;x< n;x++)
{
for (int y=0;y<= n;y++)
{
if (y != n)
gotoxy(4+7*y,3+x);
else
gotoxy(13+7*(y-1),x+3);
scanf("%f",&mat[x][y]);
}
}
}
void ver(char signo, int l1,int l2, float c)
{
gotoxy(10,5+n);
textcolor(BLUE);
switch(signo)
{
case '/' :
printf("R %d // %8.2f = R %dn",l1,c,l1);
break;
case '+' :
printf("R %d - %8.2f R %d = R %d n",l1,c,l2,l1);
break;
case '=' :
printf("R %d <===> R %dn",l1,l2);
break;
case '-' :
printf("MATRIZ DEL SISTEMAn");
}
textcolor(RED);
for (int x= 0;x<n;x++)
{
for (int y=0;y<= n;y++)
{
gotoxy(7*(y+1),10+x);
printf("%5.2f",mat[x][y]);
}
}
gotoxy(10,24);
textcolor(WHITE + BLINK);
printf("PRESIONE CUALQUIER TECLA PARA CONTINUARn");
getch();
}
void cambiar(int &l1,int &l2)
{
for (int y =0;y<=n;y++)
{
float aux = mat[l1][y];
mat[l1][y] = mat[l2][y];
mat[l2][y] = aux;
}
}
void calcular()
{
int x,y,x1,y1;
float c ;
int cont,sepudo;
for (x=0;x<n;x++)
{
cont = 0;
sepudo = 1;
do
{
cont++;
c = mat[x][x];
if (c == 0)
if (cont+x <= n)
{
cambiar(x,x+cont);
ver('=',x,x+cont,1);
c = mat[x][x];
}
else
sepudo = 0;
}while( (c == 0) && sepudo);
if (sepudo)
{
for (y =x;y<=n;y++)
mat[x][y] = mat[x][y] / c;
ver('/',x,x,c);
for( x1 = x+1;x1<n;x1++)
{
c = mat[x1][x];
for (y1 = x;y1<=n;y1++)
mat[x1][y1] = mat[x1][y1] - c * mat[x][y1];
ver('+',x1,x,c);
}
for (x1 = x-1;x1>=0;x1--)
{
c = mat[x1][x];
for (y1 = x;y1<=n;y1++)
mat[x1][y1] = mat[x1][y1] - c * mat[x][y1];
ver('+',x1,x,c);
}
}
}
if (!sepudo)
{
gotoxy(10,23);
printf("NO TIENE SOLUCION o TIENE INFINITAS SOLUCIONESn");
}
}
void main()
{
do
{
ingreso();
if (n > 0)
{
ver('-',1,1,1);
calcular();
}
gotoxy(10,24);
textcolor(WHITE);
printf("Desea resolver otro sistema (S/N) N");
op = toupper(getch());
}while(op == 'S');
}
// con el metodo gauss jordan
// paso a paso
// te muestra todas las operaciones de renglon
/ espero que te sirva
#include <stdio.h>
#include <string.h>
#include <conio.h>
#include <iostream.h>
#include <stdlib.h>
#include <ctype.h>
const max = 15;
typedef float matriz[max][max];
int n;
matriz mat;
char op;
void ingreso()
{
clrscr();
printf("Eliminacion Gauss Jordann");
printf("n ? ");
scanf("%d",&n);
clrscr();
textcolor(RED);
for (int x=0;x<n ;x++)
{
for (int y=0;y<= n;y++)
{
if (y != n)
{
gotoxy(7+7*y,3+x);
printf("%c",(108+y));
}
else
printf(" =");
}
}
textcolor(WHITE);
for (x=0;x< n;x++)
{
for (int y=0;y<= n;y++)
{
if (y != n)
gotoxy(4+7*y,3+x);
else
gotoxy(13+7*(y-1),x+3);
scanf("%f",&mat[x][y]);
}
}
}
void ver(char signo, int l1,int l2, float c)
{
gotoxy(10,5+n);
textcolor(BLUE);
switch(signo)
{
case '/' :
printf("R %d // %8.2f = R %dn",l1,c,l1);
break;
case '+' :
printf("R %d - %8.2f R %d = R %d n",l1,c,l2,l1);
break;
case '=' :
printf("R %d <===> R %dn",l1,l2);
break;
case '-' :
printf("MATRIZ DEL SISTEMAn");
}
textcolor(RED);
for (int x= 0;x<n;x++)
{
for (int y=0;y<= n;y++)
{
gotoxy(7*(y+1),10+x);
printf("%5.2f",mat[x][y]);
}
}
gotoxy(10,24);
textcolor(WHITE + BLINK);
printf("PRESIONE CUALQUIER TECLA PARA CONTINUARn");
getch();
}
void cambiar(int &l1,int &l2)
{
for (int y =0;y<=n;y++)
{
float aux = mat[l1][y];
mat[l1][y] = mat[l2][y];
mat[l2][y] = aux;
}
}
void calcular()
{
int x,y,x1,y1;
float c ;
int cont,sepudo;
for (x=0;x<n;x++)
{
cont = 0;
sepudo = 1;
do
{
cont++;
c = mat[x][x];
if (c == 0)
if (cont+x <= n)
{
cambiar(x,x+cont);
ver('=',x,x+cont,1);
c = mat[x][x];
}
else
sepudo = 0;
}while( (c == 0) && sepudo);
if (sepudo)
{
for (y =x;y<=n;y++)
mat[x][y] = mat[x][y] / c;
ver('/',x,x,c);
for( x1 = x+1;x1<n;x1++)
{
c = mat[x1][x];
for (y1 = x;y1<=n;y1++)
mat[x1][y1] = mat[x1][y1] - c * mat[x][y1];
ver('+',x1,x,c);
}
for (x1 = x-1;x1>=0;x1--)
{
c = mat[x1][x];
for (y1 = x;y1<=n;y1++)
mat[x1][y1] = mat[x1][y1] - c * mat[x][y1];
ver('+',x1,x,c);
}
}
}
if (!sepudo)
{
gotoxy(10,23);
printf("NO TIENE SOLUCION o TIENE INFINITAS SOLUCIONESn");
}
}
void main()
{
do
{
ingreso();
if (n > 0)
{
ver('-',1,1,1);
calcular();
}
gotoxy(10,24);
textcolor(WHITE);
printf("Desea resolver otro sistema (S/N) N");
op = toupper(getch());
}while(op == 'S');
}