unit UnitCalc;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TFormCalc = class(TForm)
    edP: TEdit;
    edS: TEdit;
    lbP: TLabel;
    lbS: TLabel;
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormCalc: TFormCalc;
  P: integer;
  S, P2: real;

implementation

uses UnitMain, UnitInput;

{$R *.dfm}


procedure TFormCalc.FormActivate(Sender: TObject);
begin
if FormInput.CheckBoxP.Checked then
 begin
  P:= FormInput.a + FormInput.b + FormInput.c;
  edP.Text:= IntToStr(P);
 end
 else edP.Text:= 'пусто';

if FormInput.CheckBoxS.Checked then
 begin
  P2:= (FormInput.a + FormInput.b + FormInput.c)/2;
  S:= sqrt(P2*(P2 - FormInput.a)*(P2 - FormInput.b)*(P2 - FormInput.c));
  edS.Text:= floattostr(S);
 end
 else edS.Text:= 'пусто';
end;

end.
