- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
unit CelFahKel;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
RadioGroup1: TRadioGroup;
RadioGroup2: TRadioGroup;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
F: Extended;
C: Integer;
begin
if RadioGroup1.ItemIndex=0 then
if RadioGroup2.ItemIndex=0 then
Edit2.Text := Edit1.Text
else if RadioGroup2.ItemIndex=1 then
begin
F := StrToFloat(Edit1.Text) * (9/5) + 32;
Edit2.Text := FloatToStr(F)
end
else if RadioGroup2.ItemIndex=2 then
begin
C := StrToInt(Edit1.Text) + 273;
Edit2.Text := FloatToStr(C);
end;
if RadioGroup1.ItemIndex=1 then
if RadioGroup2.ItemIndex=0 then
begin
F := StrToFloat(Edit1.Text) - 32 * (5/9);
Edit2.Text := FloatToStr(F);
end
else if RadioGroup2.ItemIndex=1 then
Edit2.Text := Edit1.Text
else if RadioGroup2.ItemIndex=2 then
begin
F := StrToFloat(Edit1.Text) - 32 * (5/9) + 273;
Edit2.Text := FloatToStr(F);
end;
if RadioGroup1.ItemIndex=2 then
if RadioGroup2.ItemIndex=0 then
begin
C := StrToInt(Edit1.Text) - 273;
Edit2.Text := IntToStr(C);
end
else if RadioGroup2.ItemIndex=1 then
begin
F := StrToFloat(Edit1.Text) + 32 * (9/5) - 273;
Edit2.Text := FloatToStr(F);
end
else if RadioGroup2.ItemIndex=2 then
Edit2.Text := Edit1.Text
end;
end.
Всего-то навсего перевод градусных величин: Сельсий <-> Фаренгейт <-> Кельвин и вывод в Эдит