unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, math;
type
TForm1 = class(TForm)
Button1: TButton;
GroupBox1: TGroupBox;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Button2: TButton;
procedure FormShow(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure bersihkan;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.bersihkan;
begin
edit1.Clear;
edit2.Clear;
edit3.Clear;
edit4.Clear;
edit5.Clear;
edit6.Clear;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
bersihkan;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
bersihkan;
edit1.SetFocus;
end;
procedure TForm1.Button1Click(Sender: TObject);
var s,c,t:Extended;
begin
if edit1.Text = '' then
begin
Application.MessageBox('Isi terlebih dahulu Mohon Ulang Kembali!','Peringatan !',MB_ICONWARNING);
edit1.SetFocus;
end
else if edit2.Text = '' then
begin
Application.MessageBox('Isi terlebih dahulu Mohon Ulang Kembali!','Peringatan !',MB_ICONWARNING);
edit2.SetFocus;
end
else if edit3.Text = '' then
begin
Application.MessageBox('Isi terlebih dahulu Mohon Ulang Kembali!','Peringatan !',MB_ICONWARNING);
edit3.SetFocus;
end
else if ((edit1.Text <> '') or (edit2.Text <> '') or (edit3.Text<> '')) then begin
s:= StrToFloat(Edit1.Text);
c:= StrToFloat(Edit2.Text);
t:= StrToFloat(Edit3.Text);
Edit4.Text:= FloatToStr(Sin(s));
Edit5.Text:= FloatToStr(Cos(c));
Edit6.Text:= FloatToStr(Tan(t));
end;
end;
end.
0 komentar:
Posting Komentar