Unit unit1;
Interface
Uses Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Stdctrls;
type TForm1 = class (TForm) Label1: TLabel; Label2: TLabel; Button1: TButton; Edit1: TEdit; Button2: TButton; procedure Button1Click (Sender: TObject); procedure Button2Click (Sender: TObject); private {Private declarations} public { Public Declarations}
Var Form1: TFORM1; Const Pi = 3.14159; Implementation
{$ R * .dfm}
Procedure TForm1.Button1Click (Sender: Tobject); VAR R, C, S: REAL; beginif Edit1.text = '' TENSHOWMESSAGE ('Enter is empty, please re-enter!') // If you do not enter data, please prompt elsebeginr: = STRTOFLOAT (EDIT1.TEXT); C: = 2 * pi * r; s: = pi * sqr (r); label2.caption: = 'The circumference of the circle is:' floattostr (c) CHR (13) 'Area is:' floattostr (s); // Display result END; END;
Procedure TFORM1.BUTTON2CLICK (Sender: TOBJECT); beginform1.close; // Exit button event END;
End.