• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
百里丶落云
Gee,gee,baby,baby
            管理     
delphi 10.2 ----简单的叠乘例子

unit Unit11;

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
TForm11 = class(TForm)
Button1: TButton;
Edit1: TEdit;
function dc(N:integer):integer;
procedure Button1Click(Sender: TObject); //定义函数叠乘
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form11: TForm11;

implementation

{$R *.dfm}

{ TForm11 }

procedure TForm11.Button1Click(Sender: TObject);
var
A:integer;
begin
A:=StrToInt(Edit1.Text);
showmessage(intToStr(dc(A)));
end;

function TForm11.dc(N: integer): integer;
begin
if N=1 then
result:=1
else
result:=dc(N-1)*n; //递归
end;

end.

年与时驰,意与日去,遂成枯落, 多不接世,悲守穷庐,将复何及。
posted on 2018-10-17 15:07  百里丶落云  阅读(226)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3