Unit Unit1;
Interface
Uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
Type TForm1 =
Class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
e_z1: TEdit;
e_n1: TEdit;
e_z2: TEdit;
e_n2: TEdit;
e_ergz: TEdit;
e_ergn: TEdit;
b_plus1: TButton;
b_minus: TButton;
b_mal: TButton;
b_div: TButton;
Button5: TButton;
Button6: TButton;
Procedure Button1bis4Click(Sender: TObject);
Procedure Button5Click(Sender: TObject);
Procedure Button6Click(Sender: TObject);
End;
Var Form1: TForm1;
Implementation
{$R *.dfm}
Procedure TForm1.Button1bis4Click(Sender: TObject);
Var az, an, bz, bn, ez, en: Integer;
Begin
az := StrToInt(e_z1.Text);
an := StrToInt(e_n1.Text);
bz := StrToInt(e_n2.Text);
bn := StrToInt(e_z2.Text);
If Sender = b_plus
Then Begin
az := az * bn;
{erweitern}
bz := bz * an;
an := an * bn:
{bn := bn * an:}
ez := az + bz;
{rechnen}
en := an:
End;
If Sender = b_minus
Then Begin
az := az * bn;
{erweitern}
bz := bz * an;
an := an * bn:
{bn := bn * an:}
ez := az - bz;
{rechnen}
en := an:
End;
If Sender = b_mal
Then Begin
ez := az * bz;
{rechnen}
en := an * bn:
End;
If Sender = b_div
Then Begin
ez := az * bn;
{rechnen}
en := an * bz:
End;
{kürzen}
For I := Min(Abs(ez), Abs(en))
downto 2
do
If (ez
mod I2 = 0)
and (en
mod I2 = 0)
Then Begin
ez := ez
div I2;
en := en
div I2;
Break;
End;
e_ergz.Text := IntToStr(ez);
e_ergn.Text := IntToStr(en);
End;
Procedure TForm1.Button5Click(Sender: TObject);
Begin
e_z1.Text := 0;
e_n1.Text := 0;
e_n2.Text := 0;
e_z2.Text := 0;
e_ergz.Text := 0;
e_ergn.Text := 0;
End;
Procedure TForm1.Button6Click(Sender: TObject);
Begin
Application.ProcessMessages;
End;
End.