, Button, Label, Edit.
a. P = 4 a, S = a 2.
.
:
Label1. Caption , Fon t , 16.
Edit1. Text .
Button1. Caption .
Button2. Caption - .
Label2. Visible false.
. . Button1 ( ) , .
unit Unit1;
Interface
Uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
Type
TForm1 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
Private
{ Private declarations }
Public
{ Public declarations }
End;
Var
Form1: TForm1;
implementatio n
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var a,s:real; // ,
Begin
a:=strToFloat(Edit1.Text); // , Edit1
//
s:=a*a; //
Label2.Visible:=true; // ,
//.
Label2.Caption:=(' '+FloatToStr(S)); //
// .
end;
// Button2 ( ), // //
procedure TForm1.Button2Click(Sender: TObject);
var a,P:real; // ,
Begin
a:=strToFloat(Edit1.Text); // , Edit1
//
P:=4*a; //
Label2.Visible:=true; // ,
//
Label2.Caption:=(' '+FloatToStr(P)); //
// .
end;
end.