zoukankan      html  css  js  c++  java
  • Handbook之015:动态数组相加

    动态数组支持直接相加,方法如下:

    image

    代码如下:

    unit Unit1;
    
    interface
    
    uses
      Winapi.Windows,
      Winapi.Messages,
      System.SysUtils,
      System.Variants,
      System.Classes,
      Vcl.Graphics,
      Vcl.Controls,
      Vcl.Forms,
      Vcl.Dialogs,
      Vcl.StdCtrls;
    
    type
      TForm1 = class(TForm)
        Memo1: TMemo;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    uses
      System.Diagnostics,
      System.Math;
    
    type
      TDays = array of Integer;
    //函数定义
    
    procedure ShowStaticArrays();
    var
      m_Day: TDays;
      I: Integer;
    begin
      SetLength(m_Day, 3);
      for I := Low(m_Day) to High(m_Day) do
      begin
        m_Day[I] := I;
      end;
    
      m_Day :=  m_Day + m_Day;     // 会修改原数组结果
      m_Day := m_Day + [520,3344];
      for I := Low(m_Day) to High(m_Day) do
      begin
        Form1.Memo1.Lines.Add('m_Day[' + I.ToString + '] := ' + m_Day[I].ToString);
      end;
    end;
    
    //计时
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      ShowStaticArrays();
    end;
    
    end.
  • 相关阅读:
    easyui-filebox上传图片到阿里
    easyUI-filebox图片上传和预览
    抓网页__第3方库选择_01
    HttpClient示例01
    JSON01_资料
    指定library路径
    Jni_Linux_01_转
    JNI简单步骤01
    JDK_环境变量
    Redis_01
  • 原文地址:https://www.cnblogs.com/GodPan/p/4908147.html
Copyright © 2011-2022 走看看