procedure TKalkulator.Button1Click(Sender: TObject);
var
A,B,tambah:real;
begin
A:=StrToFloat(Edit1.Text);
B:=StrToFloat(Edit2.Text);
tambah:=A+B;
Edit3.Text:=FloatToStr(tambah);
end;
procedure TKalkulator.Button2Click(Sender: TObject);
var
A,B,kurang:real;
begin
A:=StrToFloat(Edit1.Text);
B:=StrToFloat(Edit2.Text);
kurang:=A-B;
Edit3.Text:=FloatToStr(kurang);
end;
procedure TKalkulator.Button3Click(Sender: TObject);
var
A,B,kali:real;
begin
A:=StrToFloat(Edit1.Text);
B:=StrToFloat(Edit2.Text);
kali:=A*B;
Edit3.Text:=FloatToStr(kali);
end;
procedure TKalkulator.Button4Click(Sender: TObject);
var
A,B,bagi:real;
begin
A:=StrToFloat(Edit1.Text);
B:=StrToFloat(Edit2.Text);
bagi:=A/B;
Edit3.Text:=FloatToStr(bagi);
end;
procedure TKalkulator.Button5Click(Sender: TObject);
var
A,B,pangkat:real;
begin
A:=StrToFloat(Edit1.Text);
pangkat:=A*A;
Edit3.Text:=FloatToStr(pangkat);
end;
procedure TKalkulator.Button6Click(Sender: TObject);
var
A,pt:real;
begin
A:=StrToFloat(Edit1.Text);
pt:=A*A*A;
Edit3.Text:=FloatToStr(pt);
end;
procedure TKalkulator.Button7Click(Sender: TObject);
var
A,c:real;
begin
A:=StrToFloat(Edit1.Text);
c:=1/A;
Edit3.Text:=FloatToStr(c);
end;
procedure TKalkulator.Button8Click(Sender: TObject);
var
A,Sinus:real;
begin
A:=StrToFloat(Edit1.Text);
Sinus:=sin(A*3.14/180);
Edit3.Text:=FloatToStr(round(sin(A*3.14/180)*100)/100);
end;
procedure TKalkulator.Button9Click(Sender: TObject);
var
A,cosinus:real;
begin
A:=StrToFloat(Edit1.Text);
cosinus:=cos(A*3.14/180);
Edit3.Text:=FloatToStr(round(cos(A*3.14/180)*100)/100);
end;
procedure TKalkulator.Button10Click(Sender: TObject);
var
A,tangen:real;
begin
A:=StrToFloat(Edit1.Text);
tangen:=(sin(A*3.14/180))/(cos(A*3.14/180));
Edit3.Text:=FloatToStr(round((sin(A*3.14/180))/(cos(A*3.14/180))*100)/100);
end;
procedure TKalkulator.Button11Click(Sender: TObject);
var
A,lon:real;
begin
A:=StrToFloat(Edit1.Text);
lon:=ln(A);
Edit3.Text:=FloatToStr(lon);
end;
procedure TKalkulator.Button12Click(Sender: TObject);
var
A,eks:real;
begin
A:=StrToFloat(Edit1.Text);
eks:=exp(A);
Edit3.Text:=FloatToStr(eks);
end;
procedure TKalkulator.Button13Click(Sender: TObject);
var
A,kosekan:real;
begin
A:=StrToFloat(Edit1.Text);
kosekan:=1/(sin(A*3.14/180));
Edit3.Text:=FloatToStr(round(1/(sin(A*3.14/180))*100)/100);
end;
procedure TKalkulator.Button14Click(Sender: TObject);
var
A,sekan:real;
begin
A:=StrToFloat(Edit1.Text);
sekan:=1/(cos(A*3.14/180));
Edit3.Text:=FloatToStr(round(1/(cos(A*3.14/180))*100)/100);
end;
procedure TKalkulator.Button15Click(Sender: TObject);
var
A,cotangen:real;
begin
A:=StrToFloat(Edit1.Text);
cotangen:=(cos(A*3.14/180))/(sin(A*3.14/180));
Edit3.Text:=FloatToStr(round((cos(A*3.14/180))/(sin(A*3.14/180))*100)/100);
end;
procedure TKalkulator.Button16Click(Sender: TObject);
var
x,a:real;
begin
x:=strtofloat(edit1.Text);
a:=sqrt(x);
edit3.Text:=floattostr(a);
end;
procedure TKalkulator.Button21Click(Sender: TObject);
var
x,y,p:real;
begin
x:=strtofloat(edit1.Text);
p:=x/100;
edit3.Text:=floattostr(p);
end;
procedure TKalkulator.Button18Click(Sender: TObject);
var n,i,f : integer;
begin
if trystrtoint(Edit1.Text,n)=false then
begin showmessage('Salah Memasukan Angka, ulangi!!!');
exit;
end;
f := 1;
for i:=1 to n do
f := f * i;
Edit3.Text:= inttostr(f);
end;
procedure TKalkulator.Button19Click(Sender: TObject);
Var x,y,z:Real;
begin
x:=StrToFloat(Edit1.Text);
y:=StrToFloat(Edit2.Text);
Z:=exp(y*ln(x));
Edit3.Text:=FloatToStr(z);
end;
procedure TKalkulator.Button20Click(Sender: TObject);
Var x,y,z:Real;
begin
x:=StrToFloat(Edit1.Text);
y:=StrToFloat(Edit2.Text);
Z:=ln(y)/ln(x);
Edit3.Text:=FloatToStr(z);
end;
procedure TKalkulator.Button22Click(Sender: TObject);
var
x,a:real;
begin
x:=strtofloat(edit1.text);
a:=abs(x);
edit3.Text:=floattostr(a);
end;
procedure TKalkulator.Button23Click(Sender: TObject);
var
x,a:real;
begin
x:=strtofloat(edit1.Text);
a:=x*(22/7);
edit3.text:=floattostr(a);
end;
procedure TKalkulator.Button24Click(Sender: TObject);
VAR
x,y,a:real;
begin
x:=strtofloat(edit1.Text);
y:=strtofloat(edit2.Text);
a:=abs(x)*abs(y);
edit3.Text:=floattostr(a);
end;
procedure TKalkulator.Button17Click(Sender: TObject);
var
a,g:real;
begin
a:=strtofloat(edit1.text);
g:=ln(a)/ln(10);
edit3.text:=floattostr(g);
end;
procedure TKalkulator.Timer1Timer(Sender: TObject);
begin
label1.Left:=label1.Left-30;
if label1.Left<=-300 then
label1.Left := 750;
end;
procedure TKalkulator.Button25Click(Sender: TObject);
begin
Edit3.Text:=' ';
Edit1.Text:=' ';
Edit2.Text:=' ';
end;
procedure TKalkulator.Button26Click(Sender: TObject);
begin
MainMenu.Show;
Kalkulator.Hide;
Minggu, 30 Oktober 2016
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar