自定义过程的创建和使用(求一个数的阶乘)

implementation

{$R *.dfm}
procedure jiecheng(var a,varlue:Int64);    //自定义一个过程:求a的阶乘,值为value
 var
  i:Integer;
begin
  varlue:=1;
  for
    i:=1 to a
  do varlue:=varlue*i;
end;


procedure TForm1.Button1Click(Sender: TObject);
var
  c,b:Int64;
begin
  c:=StrToInt(edt1.Text);      //edit1中输入一个数c
  jiecheng(c,b);               //调用前面的自定义过程
  edt2.Text:=IntToStr(b);      //在edit2中显示c的阶乘值:b
end;

end.

转载于:https://www.cnblogs.com/bytutu/archive/2011/11/25/2263879.html

你可能感兴趣的:(自定义过程的创建和使用(求一个数的阶乘))