Добавил:
Xer1t
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Лаба 7 вар 9 / 2 / Unit1
.pas unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Math;
type
TForm1 = class(TForm)
LabeledEdit1: TLabeledEdit;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var x, a, s, t:real;
var k:byte;
const n=12;
const k1=2;
begin
x:=StrToFloat(LabeledEdit1.Text);
a:=1; k:=2; s:=1; t:=0;
for k:=2 to n do
begin
a:=1-Power((x/(k*3.14)),2);
t:=t+1;
s:=s*a;
end;
Label1.Caption:='S='+FloatToStrF(s, ffFixed, 10, 5);
Label2.Caption:='слагаемых в сумме '+FloatToStr(t);
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Math;
type
TForm1 = class(TForm)
LabeledEdit1: TLabeledEdit;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var x, a, s, t:real;
var k:byte;
const n=12;
const k1=2;
begin
x:=StrToFloat(LabeledEdit1.Text);
a:=1; k:=2; s:=1; t:=0;
for k:=2 to n do
begin
a:=1-Power((x/(k*3.14)),2);
t:=t+1;
s:=s*a;
end;
Label1.Caption:='S='+FloatToStrF(s, ffFixed, 10, 5);
Label2.Caption:='слагаемых в сумме '+FloatToStr(t);
end;
end.