Function factor1(N:integer):integer;//Факториал в числителе var k:integer; Begin N:=k-1; if N=0 then factor1:=1 else factor1:=N*factor1(N-1); end;
Function factor2(M:integer):integer;//Факториал в знаменателе var k:integer; Begin M:=k-2; if M=0 then factor2:=1 else factor2:=M*factor2(M-1); end;
Function F(k:integer):real;//Сама функкция F(k) var factor1:integer; factor2:integer; Begin If k= 0 then Result:= 0 Else Begin If k=1 then result:=2; If k>1 then begin If k > 1 Result:=F(factor1)/F(factor2); end; End; End;
procedure TForm1.Button1Click(Sender: TObject); var k, N,M:integer; Result:Real; begin
k := StrToInt(Edit1.Text); N:=k-1; M:=k-2; factor1(N); factor2(M); Result;//ОШИБКА ([Error] Unit1.pas(74): Statement expected, but expression of type 'Real' found)
//Вывод результата label3.caption:='Çíà÷åíèå ôóíêöèè ïðè k '+Edit1.Text + ' ðàâåíî '+IntToFloat(Result);
end; end.
|
|
|