zoukankan      html  css  js  c++  java
  • Handbook之013:静态数组

    静态数组赋值方法如下:

    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
      TDayTemperatures = array[1..24] of Integer;
    //函数定义
    
    procedure ShowStaticArrays();
    var
      m_DayTemperatures: TDayTemperatures;
      I: Integer;
    begin
      for I := Low(m_DayTemperatures) to High(m_DayTemperatures) do
      begin
        m_DayTemperatures[I] := I;
      end;
    
      for I := Low(m_DayTemperatures) to High(m_DayTemperatures) do
      begin
        Form1.Memo1.Lines.Add('m_DayTemperatures[' + I.ToString + '] := ' + m_DayTemperatures[I].ToString);
      end;
    
    end;
    //定义函数构型
    
    type
      TIntProc = procedure(Num: Integer);
    
    //计时
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      ShowStaticArrays();
    end;
    
    end.
  • 相关阅读:
    世界编程大赛第一名编写的程序3D世界
    bool与BOOL
    防浪涌电路
    用户至上,体验第一
    VC菜菜鸟创建多线程任务HelloWorld
    Google,a good dog
    算法学习之路
    巧用VC工程下的rc文件
    堆与栈
    关于信息量的压缩
  • 原文地址:https://www.cnblogs.com/GodPan/p/4908129.html
Copyright © 2011-2022 走看看