unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Spin;
type
TVektor =
array of Integer;
TMatrix =
array of TVektor;
type
TForm1 =
class(TForm)
sV1: TEdit;
SV2: TEdit;
EV2: TEdit;
Ev1: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Button1: TButton;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
se: TSpinEdit;
Label5: TLabel;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
m: tMatrix;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure VOut(v: tVektor; e: tEdit);
var
i: integer;
begin
e.Text := '
{';
for i := 0
to high(v)
do
begin
e.text := e.text + inttostr(v[i]);
if i < high(v)
then
e.text := e.text + '
; ';
end;
e.Text := e.text + '
}';
end;
function AddVektor(
const fromVektor, toVektor: tVektor; Skalar: integer): tVektor;
var
i: integer;
begin
setlength(result, high(toVektor)+1);
for i := low(fromVektor)
to high(fromVektor)
do
result[i] := fromVektor[i]*Skalar + toVektor[i];
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
VOut(M[0], EV1);
VOut(AddVektor(M[0], M[1], se.Value), EV2);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
//2 Zeilen mit 3 Spalten
setlength(M, 2, 3);
M[0, 0] := 1; M[1, 0] := 2;
M[0, 1] := 2; M[1, 1] := -1;
M[0, 2] := 1; M[1, 2] := 1;
VOut(M[0], sV1);
VOut(M[1], sV2);
end;
end.