Александр1111
Ученик
- Регистрация
- 18 Мар 2012
- Сообщения
- 7
- Реакции
- 0
- Баллы
- 0
Помогите найти ошибку
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Edit2: TEdit;
Button1: TButton;
Label3: TLabel;
Edit3: TEdit;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
end.
procedure TForm1.Button1Click(Sender: TObject);
var n,x,step1,step2,i,q: integer;
function st (n: integer): real;
begin
if n=0 then st:=1;
if n>0 then st:=x*step2
else st:=1/step1;
end;
begin
x:=StrToFloat(Edit1.Text);
n:=StrToInt(Edit2.Text);
step1:=1; step2:=1;
for i:=1 to(n-1) do
step2:=step2*x;
for q:=(-1) downto n do
step1:=step1*x;
Edit3.Text:=IntToStr(st
);
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Edit2: TEdit;
Button1: TButton;
Label3: TLabel;
Edit3: TEdit;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
end.
procedure TForm1.Button1Click(Sender: TObject);
var n,x,step1,step2,i,q: integer;
function st (n: integer): real;
begin
if n=0 then st:=1;
if n>0 then st:=x*step2
else st:=1/step1;
end;
begin
x:=StrToFloat(Edit1.Text);
n:=StrToInt(Edit2.Text);
step1:=1; step2:=1;
for i:=1 to(n-1) do
step2:=step2*x;
for q:=(-1) downto n do
step1:=step1*x;
Edit3.Text:=IntToStr(st
end.