Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4106
Number of posts: 14016

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Pascal problem with double dimensional function Posted by Anarki667 on 31 Dec 2012 at 8:20 PM
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;
Report
Re: Pascal problem with double dimensional function Posted by Actor21 on 1 Jan 2013 at 5:17 AM
types cannot be declared in the parameter list of a function.

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

function detrm(matrix : matrixtype ; 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;                       




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.