
Добавил:
Yanus
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Лабы Паскаль / лабы 2 / Unit1
.pas unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Panel1: TPanel;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Edit3: TEdit;
Edit4: TEdit;
Label6: TLabel;
Label7: TLabel;
Edit5: TEdit;
Edit6: TEdit;
Label8: TLabel;
Panel2: TPanel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
t1,t2,t3,t4,t5,t6:extended;
a,b,c,p,Per:real;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
t1:=strtofloat(Edit1.Text);
t2:=strtofloat(Edit2.Text);
t3:=strtofloat(Edit3.Text);
t4:=strtofloat(Edit4.Text);
t5:=strtofloat(Edit5.Text);
t6:=strtofloat(Edit6.Text);
a:=sqrt(sqr(t1-t3)+sqr(t2-t4));
b:=sqrt(sqr(t3-t5)+sqr(t4-t6));
c:=sqrt(sqr(t5-t1)+sqr(t6-t2));
Per:=a+b+c;
Panel1.Caption:='Периметр'+'='
+Floattostr(Per);
p:=Per/2;
Panel2.Caption:='Площадь'+'='
+Floattostr(sqrt(p*(p-a)*(p-b)*(p-c)));
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Panel1: TPanel;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Edit3: TEdit;
Edit4: TEdit;
Label6: TLabel;
Label7: TLabel;
Edit5: TEdit;
Edit6: TEdit;
Label8: TLabel;
Panel2: TPanel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
t1,t2,t3,t4,t5,t6:extended;
a,b,c,p,Per:real;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
t1:=strtofloat(Edit1.Text);
t2:=strtofloat(Edit2.Text);
t3:=strtofloat(Edit3.Text);
t4:=strtofloat(Edit4.Text);
t5:=strtofloat(Edit5.Text);
t6:=strtofloat(Edit6.Text);
a:=sqrt(sqr(t1-t3)+sqr(t2-t4));
b:=sqrt(sqr(t3-t5)+sqr(t4-t6));
c:=sqrt(sqr(t5-t1)+sqr(t6-t2));
Per:=a+b+c;
Panel1.Caption:='Периметр'+'='
+Floattostr(Per);
p:=Per/2;
Panel2.Caption:='Площадь'+'='
+Floattostr(sqrt(p*(p-a)*(p-b)*(p-c)));
end;
end.