Contoh Skrip nya
Menentukan Tipe Data nya
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Label3: TLabel;
Edit3: TEdit;
Button7: TButton;
Button8: 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 TForm1.Button1Click(Sender: TObject);
var a,g,i:real;
begin
a:=StrToFloat(Edit1.Text);
g:=StrToFloat(Edit2.Text);
i:=a+g;
Edit3.Text:=FloatToStr(i);
end;
procedure TForm1.Button2Click(Sender: TObject);
var a,g,i:real;
begin
a:=StrToFloat(Edit1.Text);
g:=StrToFloat(Edit2.Text);
i:=a-g;
Edit3.Text:=FloatToStr(i);
end;
procedure TForm1.Button3Click(Sender: TObject);
var a,g,i:real;
begin
a:=StrToFloat(Edit1.Text);
g:=StrToFloat(Edit2.Text);
i:=a*g;
Edit3.Text:=FloatToStr(i);
end;
procedure TForm1.Button4Click(Sender: TObject);
var a,g,i:real;
begin
a:=StrToFloat(Edit1.Text);
g:=StrToFloat(Edit2.Text);
i:=a/g;
Edit3.Text:=FloatToStr(i);
end;
procedure TForm1.Button5Click(Sender: TObject);
var a,g,i:integer;
begin
a:=StrToInt(Edit1.Text);
g:=StrToInt(Edit2.Text);
i:=a div g;
Edit3.Text:=IntToStr(i);
end;
procedure TForm1.Button6Click(Sender: TObject);
var a,g,i:integer;
begin
a:=StrToInt(Edit1.Text);
g:=StrToInt(Edit2.Text);
i:=a mod g;
Edit3.Text:=IntToStr(i);
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
Edit1.Clear;
Edit2.Clear;
Edit3.Clear;
end;
procedure TForm1.Button8Click(Sender: TObject);
begin
Close;
end;
end.
Tidak ada komentar:
Posting Komentar