加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

delphi 10.2---非常简单的数组用法求和

发布时间:2020-12-15 09:54:43 所属栏目:大数据 来源:网络整理
导读:unit Unit9; interface uses Winapi.Windows,Winapi.Messages,System.SysUtils,System.Variants,System.Classes,Vcl.Graphics, Vcl.Controls,Vcl.Forms,Vcl.Dialogs,Vcl.StdCtrls; TYPE Arr=array[0..10] of integer; type TForm9 = class(TForm) Button1: T

unit Unit9;

interface

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

TYPE
Arr=array[0..10] of integer;
type
TForm9 = class(TForm)
Button1: TButton;
function Arrinit(MM:arr):arr;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form9: TForm9;

implementation

{$R *.dfm}

?

{ TForm9 }

function TForm9.Arrinit(MM: arr): arr;
var
i:integer;
begin
for I := 0 to 10 do
begin
MM[i]:=i;
end;
result:=MM;
end;

procedure TForm9.Button1Click(Sender: TObject);
var
AA:arr;
i,sum:Integer;
begin
sum:=0;
AA:=Arrinit(aa);
for i := 0 to 10 do
begin
sum:=sum+AA[i];
end;
showmessage(IntToStr(sum));
end;

end.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读