unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
Tll =
class(TForm)
edit_eingabe: TEdit;
btm_1: TButton;
btm_2: TButton;
btm_plus: TButton;
lbl_wert: TLabel;
lbl_operation: TLabel;
btm_gleich: TButton;
btm_kerwert: TButton;
btm_minus: TButton;
btm_mal: TButton;
btm_geteilt: TButton;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Button8: TButton;
Button9: TButton;
btm_loeschen: TButton;
Button10: TButton;
btm_prozent: TButton;
btmk_wurzel: TButton;
Button11: TButton;
btm_ce: TButton;
btm_back: TButton;
btm_mc: TButton;
btm_ms: TButton;
btm_mr: TButton;
btm_mplus: TButton;
btm_mminus: TButton;
lbl_speicherm: TLabel;
lbl_speicheranzeige: TLabel;
procedure btm_1Click(Sender: TObject);
procedure btm_2Click(Sender: TObject);
procedure btm_plusClick(Sender: TObject);
procedure btm_gleichClick(Sender: TObject);
procedure btm_kerwertClick(Sender: TObject);
procedure btm_minusClick(Sender: TObject);
procedure btm_malClick(Sender: TObject);
procedure btm_geteiltClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure btm_loeschenClick(Sender: TObject);
procedure Button10Click(Sender: TObject);
procedure btm_prozentClick(Sender: TObject);
procedure btmk_wurzelClick(Sender: TObject);
procedure Button11Click(Sender: TObject);
procedure btm_ceClick(Sender: TObject);
procedure btm_backClick(Sender: TObject);
procedure btm_msClick(Sender: TObject);
procedure btm_mcClick(Sender: TObject);
procedure btm_mrClick(Sender: TObject);
procedure btm_mplusClick(Sender: TObject);
procedure btm_mminusClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
ll: Tll;
implementation
{$R *.DFM}
procedure Tll.btm_1Click(Sender: TObject);
begin
edit_eingabe.Text := edit_eingabe.text+'
1';
end;
procedure Tll.btm_2Click(Sender: TObject);
begin
edit_eingabe.Text := edit_eingabe.text+'
2';
end;
procedure Tll.btm_plusClick(Sender: TObject);
begin
lbl_wert.Caption := edit_eingabe.text;
edit_eingabe.text := '
' ;
lbl_operation.caption := '
+' ;
//edit_eingabe.SetFocus;
end;
procedure Tll.btm_gleichClick(Sender: TObject);
var
wert_aktuell, wert_gespeichert: double;
ergebnis:double;
begin
ergebnis:=0;
wert_aktuell := StrToFloat(edit_eingabe.text);
wert_gespeichert := StrToFloat(lbl_wert.caption);
if lbl_operation.caption= '
+'
then ergebnis := wert_aktuell + wert_gespeichert
else
If lbl_operation.caption = '
-'
then ergebnis := wert_gespeichert - wert_aktuell;
if lbl_operation.caption= '
*'
then ergebnis := wert_aktuell * wert_gespeichert
else
If lbl_operation.caption = '
/'
then ergebnis := wert_gespeichert / wert_aktuell;
edit_eingabe.text := FloatToStr(ergebnis);
lbl_operation.caption := '
' ;
lbl_wert.Caption := '
' ;
end;
procedure Tll.btm_kerwertClick(Sender: TObject);
var
aktueller_wert, ergebnis: double;
begin
if ((edit_eingabe.text='
0')
or (edit_eingabe.text='
'))
then exit;
aktueller_wert := StrToFloat(edit_eingabe.text);
ergebnis := 1/aktueller_wert;
edit_eingabe.text := FloatToStr(ergebnis);
end;
procedure Tll.btm_minusClick(Sender: TObject);
begin
lbl_wert.Caption := edit_eingabe.text;
edit_eingabe.text := '
' ;
lbl_operation.caption := '
-' ;
end;
procedure Tll.btm_malClick(Sender: TObject);
begin
lbl_wert.Caption := edit_eingabe.text;
edit_eingabe.text := '
' ;
lbl_operation.caption := '
*' ;
end;
procedure Tll.btm_geteiltClick(Sender: TObject);
begin
lbl_wert.Caption := edit_eingabe.text;
edit_eingabe.text := '
' ;
lbl_operation.caption := '
/' ;
end;
procedure Tll.Button1Click(Sender: TObject);
begin
edit_eingabe.Text := edit_eingabe.text+'
3';
end;
procedure Tll.Button2Click(Sender: TObject);
begin
edit_eingabe.Text := edit_eingabe.text+'
4';
end;
procedure Tll.Button3Click(Sender: TObject);
begin
edit_eingabe.Text := edit_eingabe.text+'
5';
end;
procedure Tll.Button4Click(Sender: TObject);
begin
edit_eingabe.Text := edit_eingabe.text+'
6';
end;
procedure Tll.Button5Click(Sender: TObject);
begin
edit_eingabe.Text := edit_eingabe.text+'
7';
end;
procedure Tll.Button6Click(Sender: TObject);
begin
edit_eingabe.Text := edit_eingabe.text+'
8';
end;
procedure Tll.Button7Click(Sender: TObject);
begin
edit_eingabe.Text := edit_eingabe.text+'
9';
end;
procedure Tll.Button8Click(Sender: TObject);
begin
edit_eingabe.Text := edit_eingabe.text+'
0';
end;
procedure Tll.Button9Click(Sender: TObject);
begin
//If Pos(':', '3278387:4582')
//then edit_eingabe.text := edit_eingabe.text+',';
if Pos('
,',edit_eingabe.text)=0
then
edit_eingabe.text := edit_eingabe.text+'
,';
end;
procedure Tll.btm_loeschenClick(Sender: TObject);
begin
edit_eingabe.Text := '
' ;
lbl_operation.caption := '
' ;
lbl_wert.Caption := '
' ;
end;
procedure Tll.Button10Click(Sender: TObject);
var Zahl:
string;
begin
Zahl:=edit_eingabe.Text;
if Pos('
-', Zahl) = 1
then
begin
Delete(Zahl, 1,1);
edit_eingabe.Text:=Zahl;
end
else
edit_eingabe.Text:='
-'+edit_eingabe.Text;
end;
procedure Tll.btm_prozentClick(Sender: TObject);
var
a, er: Extended;
begin
a := strtofloat (lbl_wert.caption);
er := strtofloat (edit_eingabe.text) * (a/100);
edit_eingabe.text := floattostr (er);
end;
procedure Tll.btmk_wurzelClick(Sender: TObject);
begin
edit_eingabe.text := floattostr(sqrt(strtofloat(edit_eingabe.text)));
end;
procedure Tll.Button11Click(Sender: TObject);
begin
edit_eingabe.text := floattostr(sqr(strtofloat(edit_eingabe.text)));
end;
procedure Tll.btm_ceClick(Sender: TObject);
begin
edit_eingabe.text := '
';
end;
procedure Tll.btm_backClick(Sender: TObject);
begin
edit_eingabe.text := Copy(edit_eingabe.text,1, Length(edit_eingabe.text)-1);
//Edit1.Text := Copy(Edit1.Text,1,Length(Edit1.Text)-1)
end;
procedure Tll.btm_msClick(Sender: TObject);
begin
lbl_speicherm.Caption := edit_eingabe.text;
lbl_speicheranzeige.caption := '
M(Es bifindet sich was im Speicher)' ;
end;
procedure Tll.btm_mcClick(Sender: TObject);
begin
lbl_speicherm.caption := '
';
lbl_Speicheranzeige.caption := '
';
end;
procedure Tll.btm_mrClick(Sender: TObject);
begin
edit_eingabe.text := lbl_speicherm.caption;
end;
procedure Tll.btm_mplusClick(Sender: TObject);
begin
lbl_speicherm.Caption := IntToStr(StrToInt(lbl_speicherm.Caption) + StrToInt(edit_eingabe.Text));
end;
procedure Tll.btm_mminusClick(Sender: TObject);
begin
lbl_speicherm.Caption := IntToStr(StrToInt(lbl_speicherm.Caption) - StrToInt(edit_eingabe.Text));
end;
end.