unit Unit10;

interface

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

type
TForm10 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit5: TEdit;
Label5: TLabel;
Button1: TButton;
function sum1(A:integer):integer;
function xj(X,Y: integer):integer;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form10: TForm10;

implementation

{$R *.dfm}

{ TForm10 }

procedure TForm10.Button1Click(Sender: TObject);
begin
if (Edit1.Text='') and (Edit3.Text='') then
begin
showmessage('请输入数字');
EXIT; //退出message
end;
Edit2.Text:=intToStr(sum1(Strtoint((Edit1.Text))));
Edit4.Text:=intToStr(sum1(Strtoint((Edit3.Text))));
Edit5.Text:=IntToStr(xj(StrToint(Edit1.Text),StrToInt(Edit3.Text)));
end;

function TForm10.sum1(A: integer): integer; //求和函数
var
i,sum1:integer; //定义变量, i ,sum1
begin
sum1:=0;
for i := 0 to A do
sum1:=sum1+i;
result:=sum1;

end;

function TForm10.xj(X, Y: integer): integer; //减法函数
begin
result:=sum1(x)-sum1(y);
end;

end.

delphi 10.2 ----简单的递归函数例子求和的更多相关文章

  1. delphi 10.2 ----简单的叠乘例子

    unit Unit11; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, Syste ...

  2. delphi 三层架构简单例子(经测试成功)

    delphi 三层架构简单例子(经测试成功) 转载 2013年12月19日 09:48:57 1100 所谓三层: (1) 客户端 (2) 服务器端 (3) 数据库 在数据访问时,使得客户端必须通过服 ...

  3. 经验分享:10个简单实用的 jQuery 代码片段

    尽管各种 JavaScirpt 框架和库层出不穷,jQuery 仍然是 Web 前端开发中最常用的工具库.今天,向大家分享我觉得在网站开发中10个简单实用的 jQuery 代码片段. 您可能感兴趣的相 ...

  4. delphi 10 seattle 安卓服务开发(三)

    delphi 10 里面的安卓服务有四种,上面的一篇文章里面的图有介绍. 今天做一个remote service 的例子.(里面一部分代码是抄别人的,如果不太清楚,自行恶补) remote servi ...

  5. 10个简单实用的 jQuery 代码片段

    尽管各种 JavaScirpt 框架和库层出不穷,jQuery 仍然是 Web 前端开发中最常用的工具库. 今天,向大家分享我觉得在网站开发中10个简单实用的 jQuery 代码片段. 1.平滑滚动到 ...

  6. 修改Delphi 10.1.2 edit控件在android的复制、剪切和粘贴样式

    Delphi 10.1.2 edit控件在android默认的复制.剪切和粘贴样式太丑,经悟能-DelphiTeacher的提示,用最简单的代码修改后稍有改观. 默认的样式: 修改后的样式: 修改FM ...

  7. delphi 10.1 Berlin 中使用自带的 Base64 编码

    delphi 10.1 berlin版本中,有好几个 base64 编码的单元可以使用,例如 Indy, MessageDigest_5,还有 CnBase64,我现在使用自带的 System.Net ...

  8. 使用Multiplayer Networking做一个简单的多人游戏例子-2/3(Unity3D开发之二十六)

    猴子原创,欢迎转载.转载请注明: 转载自Cocos2Der-CSDN,谢谢! 原文地址: http://blog.csdn.net/cocos2der/article/details/51007512 ...

  9. 使用delphi 10.2 开发linux 上的Daemon

    delphi 10.2 支持linux, 而且官方只是支持命令行编程,目地就是做linux 服务器端的开发. 既然是做linux服务器端的开发,那么普通的命令行运行程序,然后等待开一个黑窗口的方式就 ...

随机推荐

  1. 04-SSH综合案例:环境搭建之jar包引入

    刚才已经把表关系的分析已经分析完了,现在呢就先不去创建这个表,写到哪儿的时候再去创建这个表. 1.4 SSH环境搭建: 1.4.1 第一步:创建一个web项目. 1.4.2 第二步:导入相应jar包. ...

  2. liunx 命令大全

    一.切换到用户 1.切换到根用户(root) su 2.切换到a用户 su a 二.建立用户,以及mysql的目录1.groupadd mysql #建立一个mysql的组2.useradd -r - ...

  3. Visual Studio 2013 boost

    E:\Visual Studio 2013\install\VC\bin\amd64>E:\IFC\boost_1_56_0_vs2013'E:\IFC\boost_1_56_0_vs2013' ...

  4. 手动制作CA证书

    一.安装 CFSSL 证书下载官方地址:https://pkg.cfssl.org #下面三个安装包,无需下载,之前百度云中的压缩包中都有[root@linux-node1 ~]# cd /usr/l ...

  5. Introduction Sockets to Programming in C using TCP/IP

    Introduction Computer Network: hosts, routers, communication channels Hosts run applications Routers ...

  6. asdfadsf

    bool is_r_value(int &&) { return true; } bool is_r_value(const int &) { return false; } ...

  7. 441. Arranging Coins

    static int wing=[]() { std::ios::sync_with_stdio(false); cin.tie(NULL); ; }(); class Solution { publ ...

  8. CodeForces 687B Remainders Game(数学,最小公倍数)

    题意:给定 n 个数,一个数 k,然后你知道一个数 x 取模这个 n 个的是几,最后问你取模 k,是几. 析:首先题意就看了好久,其实并不难,我们只要能从 n 个数的最小公倍数是 k的倍数即可,想想为 ...

  9. 使用 John the Ripper 破解 Windows 密码

    cd /target/windows/system32/config 使用 SamDump2 来提取哈希,并将文件放到你的 root 用户目录中的一个叫做 hashes 的 文件夹中. samdump ...

  10. m2e 插件

    官网 http://www.eclipse.org/m2e/ 在线安装地址 http://download.eclipse.org/technology/m2e/releases 插件简介 Launc ...