unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
RadioGroup1: TRadioGroup;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
procedure RadioGroup1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
var F, C, K : real;
ZF1, ZF2: string;
{$R *.dfm}
procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
IF RadioGroup1.ItemIndex = 0 Then
Label2.Caption:=' Temperatur in °C ';
If RadioGroup1.ItemIndex = 1 Then
Label2.Caption:=' Temperatur in °F ';
If RadioGroup1.ItemIndex = 2 Then
Label2.Caption:=' Temperatur in Grad';
edit1.Text:='';
Label3.Caption:='';
edit1.SetFocus;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
If RadioGroup1.ItemIndex=0 Then
begin
C:=StrToFloat(edit1.text);
F:=32+1.8*C; K:=C+273.15;
ZF1:=FloatToStrF(F,ffgeneral,4,1);
ZF2:=FloatToStrF(C,ffgeneral,4,1);
label3.Caption:=' Das entspricht '+ZF1+' °F, ' +
'die absolute Temperatur = ' + ZF2 + 'Grad';
end;
If RadioGroup1.ItemIndex=1 Then
begin
F:=StrToFloat(edit1.text);
C:=(F-32)/1.8; K:=C + 273.15 ;
ZF1:=FloatToStrF(C,ffgeneral,4,1);
ZF2:=FloatToStrF(K,ffgeneral,4,1);
label3.caption:=' Das entspricht '+ZF1+' °C, '+
'die absolute Temperatur = ' + ZF2+ ' Grad';
end;
If RadioGroup1.ItemIndex=2 Then
begin
K:=StrToFloat(edit1.text);
c:=K - -273.15;
F:=32+1.8*C;
ZF1:=FloatToStrF(C,ffgeneral,4,1);
ZF2:=FloatToStrF(F,ffgeneral,4,1);
label3.caption:=' Das entspricht '+ZF1+' °C und '+ ZF2+ '°F';
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
end.
RANDOM IF...THEN...ELSE CANVAS