Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Var
- x,y,z,f,c:array of array of integer;
- n,i,j,k,m,u,valor,temp:integer;
- begin
- memo1.clear;
- n := strtoint(inputbox('Caja de matriz','TamaƱo de la matriz cuadrada NxN','0'));
- SetLength(x, n, n);
- for i:=0 to n-1 do
- for j:=0 to n-1 do
- begin
- x[i,j]:= strtoint(inputbox('Caja de matriz','Valores de la matriz','0'));
- end;
- SetLength(y, n, n);
- for j:=0 to n-1 do
- for i:=0 to n-1 do
- begin
- y[i,j]:= x[i,j];
- end;
- SetLength(z, n, n);
- for i:=0 to n-1 do
- for j:=0 to n-1 do
- begin
- z[i,j]:= strtoint(inputbox('Caja de matriz identidad','Valores de la matriz','0'));
- end;
- SetLength(f, n, n);
- for i:=1 to 2 do
- for j:=1 to 2 do
- begin
- valor:= x[i,j]-z[i,j];
- f[i,j]:= valor;
- end;
- SetLength(c, n, n);
- //Multiplicación.
- for i:=0 to n-1 do
- for j:=0 to n-1 do
- begin
- temp := 0;
- for k:=0 to n-1 do
- begin
- temp := temp + y[i,k] * f[k,j];
- c[i,j] := temp;
- end;
- end;
- //Para borrar el espacio reservado para los arreglos
- x:= nil;
- y:= nil;
- f:= nil;
- z:= nil;
- c:= nil;
- end;
Advertisement
Add Comment
Please, Sign In to add comment