Witam mam napisany program na obliczanie wyznacznika macierzy metoda Laplace`a, ale mam przepelnienie stosu, pomoze ktos i poprawi, albo podpowie jak poprawic. Z gory dzieki.
Program macierz;
const
nmax=100;
type
t=array[1..nmax,1..nmax] of integer;
var n,i,j:integer;
var a:t;
function power(a, b:integer): integer;
begin
if b=1 then power:= a
else
power:=a*power(a,b-1)
end;
function wyzn(rozm: integer; licz: t):integer;
var minor:t;
j, k, m: integer;
begin
wynik:= 0;
if rozm = 1 then
wynik:= licz[1][1]
else
for j:=1 to rozm do
begin
for k:=2 to rozm do
for m:=1 to rozm do
begin
if m<j then minor[k-1][m]:= licz[k][m];
if m>j then minor[k-1][m-1]:= licz[k][m];
end;
wynik:= wynik+power(-1,j+1)*licz[1][j]*wyzn(rozm-1,minor);
end;
wyzn:= wynik;
end;
begin
write('podaj rozmiar n: ');
readln(n);
for i:=1 to n do
for j:=1 to n do
begin
write('Podaj parametr');
read(a[i,j])
end;
write('Det A= ',wyzn(n,a));
end.