Информатика. Программирование в Delphi
150
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Math;
{$R *.dfm}
procedure TForm1.EditKeyPress(Sender: TObject; var Key: Char);
var
Edit:TEdit;
begin
Edit:=Sender as TEdit;
case key of
'0'..'9',#8:;
',','.':
begin
Key:=DecimalSeparator;
if pos(DecimalSeparator,Edit.Text)<>0 then
key:=#0;
end;
#13:
case Edit.Tag of
1:Edit2.SetFocus;
2:Edit3.SetFocus;
3:Button1.SetFocus;
end
else
key:=#0;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
distance:real;
price:real;
consumption:real;
cost:real;