
10.12.2010, 17:17
|
Прохожий
|
|
Регистрация: 06.06.2010
Сообщения: 15
Репутация: 12
|
|
У maskedit-ов ставишь editmask в 00
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, ComCtrls, StdCtrls, Mask, Buttons;
type
TForm1 = class(TForm)
medt1: TMaskEdit;
btn1: TBitBtn;
medt2: TMaskEdit;
rg1: TRadioGroup;
mmo1: TMemo;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function srarifm:Real;
begin
Result:=(StrToInt(Form1.medt1.text)+strtoint(Form1.medt2.text))/2
end;
function srgeom:Real;
begin
Result:=Sqrt(StrToInt(Form1.medt1.text)*strtoint(Form1.medt2.text))
end;
procedure count;
begin
if Form1.rg1.ItemIndex=0 then Form1.mmo1.Lines.Append(FloatToStr(srarifm))
else Form1.mmo1.Lines.Append(FloatToStr(srgeom))
end;
procedure TForm1.btn1Click(Sender: TObject);
begin
count;
end;
end.
|