KONVERSI SUHU

 var

  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);

begin

  PILIHAN.Items.ADD(‘CELCIUS’);

  PILIHAN.Items.Add(‘FAHRENHEIT’);

  PILIHAN.Items.ADD(‘REAMUR’);

  PILIHAN.Items.Add(‘KELVIN’);

end; 

procedure TForm1.Button1Click(Sender: TObject);

var

  c,f,r,k:real;

begin

  if pilihan.Text=(‘CELCIUS’) then

    begin

      edit1.Text:=(‘FAHRENHEIT’);

      edit2.Text:=(‘REAMUR’);

      edit3.Text:=(‘KELVIN’);

      c:=strtofloat(edit4.Text);

      edit5.Text:=floattostr((c*1.8)+32); //fahrenheit

      edit6.Text:=floattostr(c*0.8); //reamur

      edit7.Text:=floattostr(c+273.15); //kelvin

    end

      else

        if pilihan.Text=(‘FAHRENHEIT’) then

          begin

            edit1.Text:=(‘CELCIUS’);

            edit2.Text:=(‘REAMUR’);

            edit3.Text:=(‘KELVIN’);

            f:=strtofloat(edit4.Text);

            edit5.Text:=floattostr((f-32)/1.8); //celcius

            edit6.Text:=floattostr((f-32)/2.25); //reamur

            edit7.Text:=floattostr((f+459.67)/1.8); //kelvin

          end

            else

              if pilihan.Text=(‘REAMUR’) then

                begin

                  edit1.Text:=(‘CELCIUS’);

                  edit2.Text:=(‘FAHRENHEIT’);

                  edit3.Text:=(‘KELVIN’);

                  r:=strtofloat(edit4.Text);

                  edit5.Text:=floattostr(r/0.8); //celcius

                  edit6.Text:=floattostr((r*2.25)+32); //fahrenheit

                  edit7.Text:=floattostr((r/0.8)+273.15); //kelvin

                end

                  else

                    if pilihan.Text=(‘KELVIN’) then

                      begin

                        edit1.Text:=(‘CELCIUS’);

                        edit2.Text:=(‘FAHRENHEIT’);

                        edit3.Text:=(‘REAMUR’);

                        k:=strtofloat(edit4.Text);

                        edit5.Text:=floattostr(k-273.15); //celcius

                        edit6.Text:=floattostr((k*1.8)-459.67); //fahrenheit

                        edit7.Text:=floattostr((k-273.15)*0.8); //reamur

                      end;

end;

procedure TForm1.Button2Click(Sender: TObject);

begin

  edit4.Text:=”;

  edit5.Text:=”;

  edit6.Text:=”;

  edit7.Text:=”;

end;

procedure TForm1.Button3Click(Sender: TObject);

begin

  close;

end;

end.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: