Pascal problem with double dimensional function - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Pascal problem with double dimensional function

Posts: 1Member
Hello, i'm pretty new in programming, but got to write a projeckt which makes diverse matrix. I've got a problem with function because can't declare double dimensional matrix. This is the code, can't figure out how to make it.

function detrm(matrix:Array[0..10,0..10] of real; k:integer):real;
var
s,det:real;
b:array[0..25,0..25] of real;
i,j,m,n,c:Integer;
begin
for c:=0 to k do
begin
m:=0;
n:=0;
for i:=0 to k do
begin
for j:=0 to k do
begin
b[i,j]:=0;
if (i<>0) and (j<>c) then
begin
b[m,n]:=matrix[i,j];
end;
end;
end;
end;

end;

• Posts: 35Member
types cannot be declared in the parameter list of a function.

[code]
[red]type
matrixtype = array[0..10,0..10] of real ;[/red]

function detrm(matrix : [red]matrixtype[/red] ; k : integer) : real ;

var
s,det:real;
b:array[0..25,0..25] of real;
i,j,m,n,c:Integer;

begin
for c:=0 to k do
begin
m:=0;
n:=0;
for i:=0 to k do
begin
for j:=0 to k do
begin
b[i,j]:=0;
if (i<>0) and (j<>c) then
begin
b[m,n]:=matrix[i,j];
end;
end;
end;
end;

end;
[/code]