首页 > 代码库 > 数组与子界

数组与子界

万一老师博客:http://www.cnblogs.com/del/archive/2008/01/09/1031199.html

type  TABC = ‘A‘..‘G‘;                {定义子界}var  abcArr: array[TABC] of Integer; {定义数组}  abc: TABC;                      {定义子界变量}begin  {数组赋值}  abcArr[‘A‘] := 11;  abcArr[‘B‘] := 22;  abcArr[‘C‘] := 33;  abcArr[‘D‘] := 44;  abcArr[‘E‘] := 55;  abcArr[‘F‘] := 66;  abcArr[‘G‘] := 77{调用数组}  ShowMessage(IntToStr(abcArr[‘G‘])); {77}  {遍历数组}  for abc := Low(abcArr) to High(abcArr) do  begin    ShowMessage(IntToStr(abcArr[abc])); {11 22 33 44 55 66 77}  end;end;

数组与子界