Function Flip(MInput:Matriks; pil:string):matriks ;
var
i,j:integer;
MOutput:Matriks;
begin
SetLength(MOutput,Length(MInput),Length(MInput[0]));
if (pil='vertical') then
begin
for i:=0 to Length(MOutput)-1 do
begin
for j:=0 to Length(MOutput[0])-1 do
begin
MOutput[i,j]:= MInput[(Length(MOutput)-1)-i,j];
end;
end;
Flip:=MOutput;
end
else
if (pil='horisontal') then
begin
for i:=0 to Length(MOutput)-1 do
begin
for j:=0 to Length(MOutput[0])-1 do
begin
MOutput[i,j]:=MInput[i, (Length(MOutput[0])-1)-j];
end;
end;
Flip:=MOutput;
end;
end;
No comments:
Post a Comment