C/Visual C - RESOLUCION DE SISTEMAS LINEALES

 
Vista:

RESOLUCION DE SISTEMAS LINEALES

Publicado por Norma Angelica (1 intervención) el 26/03/2001 01:51:54
HOLA, ESTOY IMPLEMENTANDO UNOS ALGORITMOS PARA MI CLASE DE METODOS NUMERICOS, PERO AL MOMENTO DE COMPILAR MI PROGRAMA ME DICE QUE CUANDO EN MAIN LLAMO A MIS FUNCIONES HAY UN ERROR EN LA COMPATIBILIDAD, PUEDE SER UN POCO TORPE MI ERROR, PERO SI ME AYUDAN, SE LOS AGRADECERE EN EL ALMA.
este es mi codigo:
#include <stdio.h>
#include<stdlib.h>
#include<malloc.h>
#include<conio.h>
#include<math.h>

int N,k,i,j,niteracion;
double TOL;
double *x1, *x2, *x3;
const MAX=20;
float a[MAX][MAX];
char opcion;



int GaussSeidel(int N,float a[MAX][MAX],double *b, double *x);
int Jacobi(int N,float a[MAX][MAX],double *b, double *x);

void main()
{
int i,j,k,N,niteracion;
printf("Introduzca el número de incógnitas a buscar:");
scanf("%d",&N);

printf("Introduza el número de iteraciones que desea que se realicen:");
scanf ("%d",&k);
printf("Indique la tolerancia deseada:");
scanf ("%d",&TOL);
printf("\n\nInserte los elementos del termino b \n");
printf("\nSeparados por un espacio\n");
x1 = (int *)calloc(N, sizeof (double));
for (i=0; i<N; i++)
fscanf(stdin,"%lf",&x1[i]);

printf("\n\nInserte el vector solución inicial:");
printf("\nElementos separados por un espacio\n");
x2 = (int*) calloc(N, sizeof (double));
for (i=0; i<N;
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:RESOLUCION DE SISTEMAS LINEALES

Publicado por Mario A. Ardila (8 intervenciones) el 27/03/2001 02:21:17
Hola: Creo que es porque no se pueden pasar arreglos a los procedimientos muy fácilmente, puedes solucionarlo de muchas formas.

1) Pasando un apuntador.
2) Haciendo un tipo definido, y luego pasándolo ej:

typedef float MyMatriz[MAX][MAX];
y en la declaración del procedimiento, tienes que hacer

int myFuncion(MyMatriz M)
{
printf("%f", ´M[0][0];
}

si tienes problemas, escríbeme, mándame el código y yo te lo arreglo ok?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar