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;

posted on 2008-01-09 00:32  万一  阅读(3013)  评论(0编辑  收藏  举报