#include
#include
#include
#include
#define A 10
#define ERRO 0
//****************
void inicio(void);
void entrada(void);
void t1(void);
int imat(float m[A][A]); //ENTRA COM A MATRIZ
int GS(float [A][A],float [A],int ); //GAUSS
int GSL(float [A][A],float [A],int,float); //GAUSS SEIDEL
void ZM(float matriz[A][A]); //ZERA A MATRIZ
void ZV(float vetor[A]); //ZERA O VECTOR
void CM(float [A][A],float [A][A]); //COPIA A MATRIZ
float ME(float vetor[A]); // CALACULA O MAIOR ELEMENTO
void entrada(void){
int i;
textmode(2);
textcolor(14+BLINK); textbackground(1);
clrscr();
gotoxy(25,25); textcolor(15+BLINK);
printf("CARREGANDO");
for(i=1;i<=80;i++){
textcolor(14);gotoxy(i,24);
printf("³");
}
for(i=1;i<=80;i++){
gotoxy(i,24);
printf("Û");
delay(1);
}
}
//*****************************************************
void t1 (void){
int i;
textmode(2);
window(1,1,80,1); textbackground(0); clrscr(); textcolor(15); clrscr();
gotoxy(15,1); printf("Sistemas Lineares - ");
window(1,2,80,2); textbackground(7); clrscr(); textcolor(0); clrscr();
gotoxy(3,1); printf("Metodos de Gauss e Gauss-Siedel");
window(1,25,80,25); textbackground(7); clrscr(); textcolor(0+BLINK);
clrscr(); gotoxy(30 ,1); printf("Diogo Rafael da Silva");
window(1,3,80,24); textbackground(1); clrscr();textcolor(15); clrscr();
for(i=2;i<=79;i++){ gotoxy(i,1); printf("Í");gotoxy(i,22); printf("Í");}
for(i=1;i<=22;i++){gotoxy(1,i); printf("º");gotoxy(80,i); printf("º");}
gotoxy(1,1); printf("É"); gotoxy(80,1); printf("»");
gotoxy(1,22); printf("È");gotoxy(80,22); printf("¼");
gotoxy(2,2); inicio();
}//t1
//-=-==-=-=--==-=-=-=-=-=--==-=-=--==========================----
void inicio(void)
{textbackground(1); textcolor(15);
float matriz[A][A],tempmatriz[A][A],resultado[A],precisao;
int num_incognitas=4,i,retorno;
char op;
ZM(matriz);
ZM(tempmatriz);
do
{
clrscr();
printf("\n\t(1) Iniciar o sistema linear");
printf("\n\t(2) Metodo Simples de Gauss");
printf("\n\t(3) Metodo de Gauss-Seidel");
printf("\n\t(4) Sair");
printf("\n\n\tFa‡a sua escolha:");
op=getche();
retorno=0;
switch(op)
{
case '1' : num_incognitas=imat(matriz);
CM(tempmatriz,matriz);
break;
case '2' : retorno=GS(matriz,resultado,num_incognitas);
break;
case '3' : {printf("\n\n\tQual ‚ a precisao:");
scanf("%f",&precisao);
retorno=GSL(matriz,resultado,num_incognitas,precisao); }
}
if(retorno)
{
printf("\n\n");
for(i=0;i=0;i--)
{
resultado[i]=matriz[i][num_incognitas];
for(j=i+1;joldprec)
{
printf("\n\n\tSistema Divergente para o metodo");
getch();
return 0;
}
oldprec=VetorPrecisao[0];
k++;
}
while(ME(VetorPrecisao)> precisao);
return 1;
}
//-------------------------
void ZV(float v[A])
{
int i;
for(i=0;im)
{
m=v[i];
}
}
return m;
}
               (
geocities.com/br/di0_s)                   (
geocities.com/br)