Anda di halaman 1dari 12

unit Unit1;

interface

uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Math;

type TForm1 = class(TForm) Edit1: TEdit; Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Button5: TButton; Button6: TButton; Button7: TButton; Button8: TButton; Button9: TButton; Button10: TButton; Button11: TButton; Button12: TButton; Button13: TButton; Button14: TButton; Button15: TButton; Button16: TButton; Button17: TButton; Button18: TButton; Button19: TButton; Button20: TButton; Button21: TButton; Button22: TButton;

Button23: TButton; Button24: TButton; Button25: TButton; Button26: TButton; Button27: TButton; Button28: TButton; Button29: TButton; Memo1: TMemo; Button30: TButton; Button31: TButton; 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 Button10Click(Sender: TObject); procedure Button11Click(Sender: TObject); procedure Button12Click(Sender: TObject); procedure Button13Click(Sender: TObject); procedure Button14Click(Sender: TObject); procedure Button15Click(Sender: TObject); procedure Button16Click(Sender: TObject); procedure Button17Click(Sender: TObject); procedure Button18Click(Sender: TObject); procedure Button19Click(Sender: TObject); procedure Button20Click(Sender: TObject); procedure Button21Click(Sender: TObject); procedure Button22Click(Sender: TObject); procedure Button23Click(Sender: TObject);

procedure Button24Click(Sender: TObject); procedure Button25Click(Sender: TObject); procedure Button26Click(Sender: TObject); procedure Button27Click(Sender: TObject); procedure Button28Click(Sender: TObject); procedure Button29Click(Sender: TObject); procedure FormActivate(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure Button30Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure Button31Click(Sender: TObject);

private { Private declarations } public { Public declarations } end;

var Form1: TForm1; islem,isaret,i,sayi3,sayi4,fakt:integer; tarihzaman,zaman:TDateTime; sayi1,sayi2,sonuc,radyan:real; implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:='';

edit1.Text:=edit1.Text+'1'; memo1.Lines.Add(Edit1.Text); end;

procedure TForm1.Button2Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:=''; edit1.Text:=edit1.Text+'2'; memo1.Lines.Add(Edit1.Text);

end;

procedure TForm1.Button3Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:=''; edit1.Text:=edit1.Text+'3'; memo1.Lines.Add(Edit1.Text); end;

procedure TForm1.Button4Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:=''; edit1.Text:=edit1.text+'4'; memo1.Lines.Add(Edit1.Text); end;

procedure TForm1.Button5Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:=''; edit1.Text:=edit1.text+'5'; memo1.Lines.Add(Edit1.Text); end;

procedure TForm1.Button6Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:=''; edit1.Text:=edit1.Text+'6'; memo1.Lines.Add(Edit1.Text); end;

procedure TForm1.Button7Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:=''; edit1.Text:=edit1.Text+'7'; memo1.Lines.Add(Edit1.Text); end;

procedure TForm1.Button8Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:=''; edit1.Text:=edit1.Text+'8'; memo1.Lines.Add(Edit1.Text); end;

procedure TForm1.Button9Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:=''; edit1.Text:=edit1.Text+'9'; memo1.Lines.Add(Edit1.Text); end;

procedure TForm1.Button10Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:=''; edit1.Text:=edit1.Text+'0'; memo1.Lines.Add(Edit1.Text);

end;

procedure TForm1.Button11Click(Sender: TObject); begin islem:=1; sayi1:=StrToFloat(edit1.text); sonuc:=sonuc+StrToFloat(edit1.text); edit1.Text:=FloatToStr(sonuc); edit1.Text:='';

end;

procedure TForm1.Button12Click(Sender: TObject); begin sayi1:=StrToFloat(edit1.Text); islem:=2; edit1.Text:='';

end;

procedure TForm1.Button13Click(Sender: TObject); begin islem:=3; sayi1:=StrToFloat(edit1.Text);

edit1.Text:='';

end;

procedure TForm1.Button14Click(Sender: TObject); begin sayi1:=StrToFloat(edit1.Text); islem:=4;

edit1.Text:='';

end;

procedure TForm1.Button15Click(Sender: TObject); begin sayi2:=StrToFloat(edit1.Text); sayi4:=StrToInt(edit1.Text); if islem=1 then sonuc:=sayi1+sayi2; if islem=2 then sonuc:=sayi1-sayi2; if islem=3 then sonuc:=sayi1*sayi2; if islem=4 then sonuc:=sayi1/sayi2; if islem=5 then sonuc:=sayi3 mod sayi4; if islem=6 then sonuc:=sayi1*sayi2/100; edit1.Text:=FloatToStr(sonuc); memo1.Lines.Add(Edit1.Text); end;

procedure TForm1.Button16Click(Sender: TObject); begin islem:=0; edit1.Text:='0'; memo1.Clear; end;

procedure TForm1.Button17Click(Sender: TObject); begin edit1.Text:=edit1.text+','; memo1.Lines.Add(Edit1.Text); end;

procedure TForm1.Button18Click(Sender: TObject); begin

if edit1.text='0' then edit1.Text:=''; sayi1:=StrToFloat(edit1.Text); sonuc:=sqr(sayi1); edit1.Text:=FloatToStr(sonuc); memo1.Lines.Add(Edit1.Text); end;

procedure TForm1.Button19Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:=''; sayi1:=StrToFloat(edit1.Text); sonuc:=sqrt(sayi1); edit1.Text:=FloatToStr(sonuc); memo1.Lines.Add(Edit1.Text); end;

procedure TForm1.Button20Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:=''; sayi1:=StrToFloat(edit1.Text); sonuc:=exp(sayi1); edit1.Text:=FloatToStr(sonuc); memo1.Lines.Add(Edit1.Text); end;

procedure TForm1.Button21Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:=''; sayi1:=StrToFloat(edit1.Text); sonuc:=ln(sayi1); edit1.Text:=FloatToStr(sonuc); memo1.Lines.Add(Edit1.Text); end;

procedure TForm1.Button22Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:=''; sayi1:=StrToFloat(edit1.text); radyan:=pi*sayi1/180; sonuc:=sin(radyan); edit1.Text:=FloatToStr(sonuc); memo1.Lines.Add(Edit1.Text); end;

procedure TForm1.Button23Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:=''; sayi1:=StrToFloat(edit1.Text); sonuc:=trunc(exp(sayi1*ln(10))); edit1.Text:=FloatToStr(sonuc); memo1.Lines.Add(Edit1.Text); end;

procedure TForm1.Button24Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:=''; sayi1:=StrToFloat(edit1.Text); sonuc:=1/sayi1; edit1.Text:=FloatToStr(sonuc); memo1.Lines.Add(Edit1.Text); end;

procedure TForm1.Button25Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:=''; edit1.Text:='-'+edit1.Text;

memo1.Lines.Add(Edit1.Text); end;

procedure TForm1.Button26Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:=''; sayi1:=StrToFloat(edit1.Text); radyan:=pi*sayi1/180; sonuc:=cos(radyan); edit1.text:=FloatToStr(sonuc); memo1.Lines.Add(Edit1.Text); end;

procedure TForm1.Button27Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:=''; sayi1:=StrToFloat(edit1.Text); radyan:=pi*sayi1/180; sonuc:=sin(radyan)/cos(radyan); edit1.Text:=FloatToStr(sonuc); memo1.Lines.Add(Edit1.Text); end;

procedure TForm1.Button28Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:=''; sayi1:=StrToFloat(edit1.Text); radyan:=pi*sayi1/180; sonuc:=cos(radyan)/sin(radyan); edit1.Text:=FloatToStr(sonuc); memo1.Lines.Add(Edit1.Text);

end;

procedure TForm1.Button29Click(Sender: TObject); begin if edit1.text='0' then edit1.Text:=''; sayi3:=StrToInt(edit1.Text); fakt:=1; for i:=1 to sayi3 do fakt:=fakt*i; edit1.text:=IntToStr(fakt); memo1.Lines.Add(Edit1.Text); end; procedure TForm1.FormActivate(Sender: TObject); begin showmessage('!Bu Hesap Makinasinda Esittire Basilmadan Islem Yapilamaz!'); end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); begin showmessage('IYI GNLER :)'); end;

procedure TForm1.Button30Click(Sender: TObject); begin sayi3:=StrToInt(edit1.Text); islem:=5; edit1.Text:='';

end;

procedure TForm1.FormCreate(Sender: TObject);

begin tarihzaman:=now; zaman:=GetTime; form1.Caption:='calculator'+' '; form1.Caption:=form1.Caption+DateToStr(date)+' end; '+TimeToStr(zaman);

procedure TForm1.Button31Click(Sender: TObject); begin sayi1:=StrToFloat(edit1.Text); islem:=6; edit1.Text:=''; end;

end.