Program konversi suhu dengan delphi
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
Edit1: TEdit;
GroupBox2: TGroupBox;
GroupBox3: TGroupBox;
Label4: TLabel;
cel1: TEdit;
BitBtn1: TBitBtn;
GroupBox4: TGroupBox;
Label5: TLabel;
fah1: TEdit;
Label2: TLabel;
Label3: TLabel;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BitBtn1Click(Sender: TObject);
var
input : real;
begin
if edit1.Text = '' then
begin
edit1.SetFocus;
end
else
begin
try
input:=strtofloat(edit1.Text);
cel1.Text:=floattostr(input * 1.8 + 32);
fah1.Text:=floattostr((input-32)/1.8);
except
on EConvertError do
begin
Messagebox(self.Handle,'Jangan memasukan String atau karakter gan :D','ooo men,check your fault',MB_OK + MB_ICONWARNING);
exit;
end;
end;
end
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
Edit1: TEdit;
GroupBox2: TGroupBox;
GroupBox3: TGroupBox;
Label4: TLabel;
cel1: TEdit;
BitBtn1: TBitBtn;
GroupBox4: TGroupBox;
Label5: TLabel;
fah1: TEdit;
Label2: TLabel;
Label3: TLabel;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BitBtn1Click(Sender: TObject);
var
input : real;
begin
if edit1.Text = '' then
begin
edit1.SetFocus;
end
else
begin
try
input:=strtofloat(edit1.Text);
cel1.Text:=floattostr(input * 1.8 + 32);
fah1.Text:=floattostr((input-32)/1.8);
except
on EConvertError do
begin
Messagebox(self.Handle,'Jangan memasukan String atau karakter gan :D','ooo men,check your fault',MB_OK + MB_ICONWARNING);
exit;
end;
end;
end
end;
end.
Komentar
Posting Komentar