IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası

IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası (https://www.ircforumlari.net/)
-   Delphi (https://www.ircforumlari.net/delphi/)
-   -   Hesap Makinası (https://www.ircforumlari.net/delphi/688193-hesap-makinasi.html)

Kaf_Dağı 11 Mart 2015 10:37

Hesap Makinası
 
Hesap Makinası

Kod:

procedure TForm1.Rakamlar(Sender: TObject);
begin
if sonuclandi then
edit1.Text:=(sender as TButton).Caption
else
edit1.Text:=edit1.Text + (sender as TButton).Caption;
sonuclandi:=False;
end;
 
procedure TForm1.Button5Click(Sender: TObject);
begin
if Length(Edit1.Text) > 0 Then
if Copy(Edit1.Text,1,1)='-' Then
Edit1.Text:=Copy(Edit1.Text,2,1000)
else
Edit1.Text:='-'+ Copy(Edit1.Text,1,1000);
 
end;
 
procedure TForm1.Button13Click(Sender: TObject);
begin
if Pos(',',Edit1.Text)=0 Then
 if Length(Edit1.Text)=0 Then
 Edit1.Text:= '0,'
 else
 Edit1.Text:=Edit1.Text + ',';
end;
 
procedure TForm1.Button26Click(Sender: TObject);
begin
Edit1.Text:='';
end;
 
procedure TForm1.Button25Click(Sender: TObject);
begin
if Length(Edit1.Text) > 0 then
Edit1.Text:=Copy(Edit1.Text,1,Length(Edit1.Text)-1);
end;
 
procedure TForm1.Hafiza_Islemleri(Sender: TObject);
begin
if Length (Edit1.Text) > 0 Then
Edit1.Text:='0';
If(sender as TButton).Caption='MC' Then
hafiza:=0;
If(sender as TButton).Caption='M+' Then
hafiza:=hafiza+StrToFloat(Edit1.Text);
If(sender as TButton).Caption='M-' Then
hafiza:=hafiza-StrToFloat(Edit1.Text);
If(sender as TButton).Caption='MR' Then
sonuclandi:=True;
end;
 
procedure TForm1.Dort_Islem(Sender: TObject);
begin
islem:=(sender as TButton).Caption;
if Length(Edit1.Text) = 0 Then
Edit1.Text:='0';
sayi1:=StrToFloat(Edit1.Text);sonuclandi:=true;
end;
 
procedure TForm1.Button21Click(Sender: TObject);
var
sonuc:double;
begin
sayi2:=StrToFloat(Edit1.Text);
case islem[1] of
 '+':
 sonuc := sayi1 + sayi2;
 '-':
 sonuc := sayi1 - sayi2;
 '*':
 sonuc := sayi1 * sayi2;
 '/':
 Begin
 if sayi2 = 0 Then
 exit;
 sonuc := sayi1 / sayi2;
 End;
 end;
 sonuclandi:=true;
 Edit1.Text:=FloatToStr(sonuc);
 sayi1:=sayi2;
end;
 
procedure TForm1.Islem_Yap_2(Sender: TObject);
var
sayi:double;
begin
if Length(Edit1.Text) = 0 Then
Edit1.Text:='0';
sayi:=StrToFloat(Edit1.Text);
if (sender as TButton).Caption='Kök' Then
 if (sayi >= 0) Then
  Edit1.Text:=FloatToStr(sqrt(sayi));
if (sender as TButton).Caption='Kare' Then
  Edit1.Text:=FloatToStr(sayi*sayi);
if (sender as TButton).Caption='1/X' Then
  if (sayi <>  0)Then
  Edit1.Text:=FloatTostr(1/sayi);
  sonuclandi:=true;
end;
 
procedure TForm1.FormCreate(Sender: TObject);
begin
Self.Caption:='Bizim Hesap Makinesi';
Edit1.Text:='';
islem:='';
end;
 
end.



Tüm Zamanlar GMT +3 Olarak Ayarlanmış. Şuanki Zaman: 14:38.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO
Copyright ©2004 - 2025 IRCForumlari.Net Sparhawk