unit berechneD;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
phi: TEdit;
e: TEdit;
d: TEdit;
ListBox1: TListBox;
ListBox2: TListBox;
ListBox3: TListBox;
Label4: TLabel;
ggT: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
q,a,b:integer;
Type
TVektor =
Record
a, b, c: Integer
End;
Var
uVektor: TVektor;
vVektor: TVektor;
cVektor: TVektor;
implementation
{$R *.dfm}
Function Vektor(
Const a, b, c: Integer): TVektor;
Begin
Result.a := a;
Result.b := b;
Result.c := c;
End;
function multiVektor(
const v: TVektor;
const q: integer):TVektor;
begin
Result.a := v.a * q;
Result.b := v.b * q;
Result.c := v.c * q;
end;
function substVektor(
const from, vek: TVektor):TVektor;
begin
Result.a := from.a - vek.a;
Result.b := from.b - vek.b;
Result.c := from.c - vek.c;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
a:=StrToInt(phi.text);
b:=StrToInt(e.text);
uVektor := Vektor(1,0,a);
vVektor := Vektor(0,1,b);
while (vVektor.c <> 0)
do
begin
q := uVektor.c
div vVektor.c;
cVektor := substVektor(uVektor, multiVektor(vVektor, q));
uVektor := vVektor;
// records einfach nur zuweisen reicht!
vVektor := cVektor;
ListBox1.Items.Add('
u1='+IntToStr(uVektor.a)) ;
ListBox1.Items.Add('
u2='+IntToStr(uVektor.b)) ;
ListBox1.Items.Add('
u3='+IntToStr(uVektor.c)) ;
ListBox2.Items.Add('
v1='+IntToStr(vVektor.a)) ;
ListBox2.Items.Add('
v1='+IntToStr(vVektor.b)) ;
ListBox2.Items.Add('
v1='+IntToStr(vVektor.c)) ;
ListBox3.Items.Add('
t1='+IntToStr(cVektor.a)) ;
ListBox3.Items.Add('
t1='+IntToStr(cVektor.b)) ;
ListBox3.Items.Add('
t1='+IntToStr(cVektor.c)) ;
end;
if (uVektor.b<0)
then
Begin
uVektor.b:=uVektor.b+a;
end;
d.Text:= IntToStr(uVektor.b) ;
ggT.text:=IntToStr(uVektor.a) +
'
*' +
IntToStr(a) +
'
+' +
IntToStr(uVektor.b) +
'
*' +
IntToStr(b);
end;
end.