您现在的位置:首页 >> 基础算法 >> window基础 >> 内容

声明const的Integer类型的多维数组时的赋值

时间:2011/9/3 15:35:09 点击:

  核心提示:type TCube4 = array[0..1, 0..1, 0..1, 0..1] of Integer; TCube3 = array[0..1, 0..1, 0..1] of Integer;...
type
  TCube4 = array[0..1, 0..1, 0..1, 0..1] of Integer;
  TCube3 = array[0..1, 0..1, 0..1] of Integer;
  TCube2 = array[0..1, 0..1] of Integer;
  TCube1 = array[0..1] of Integer;
 
const
  Maze4: TCube4 = ((((0, 1), (2, 3)), ((4, 5), (6, 7))), (((8, 9), (10, 11)), ((12, 13), (14, 15))));
  Maze3: TCube3 = (((0, 1), (2, 3)), ((4, 5), (6, 7)));
  Maze2: TCube2 = ((0, 1), (2, 3));
  Maze1: TCube1 = (0, 1);
 
var
  i, j, k, l: Integer;
  S: string;
 
begin
  for i := 0 to 1 do
    for j := 0 to 1 do
    begin
      S := '';
      S := Format('Maze[%d, %d]', [i, j]);
      S := S + '=>' + IntToStr(Maze2[i, j]);
      Memo1.Lines.Add(S);
    end;
 
  Memo1.Lines.Add('');
 
  for i := 0 to 1 do
    for j := 0 to 1 do
      for k := 0 to 1 do
      begin
        S := '';
        S := Format('Maze3[%d, %d, %d]', [i, j, k]);
        S := S + '=>' + IntToStr(Maze3[i, j, k]);
        Memo1.Lines.Add(S);
      end;
 
  Memo1.Lines.Add('');
 
  for i := 0 to 1 do
    for j := 0 to 1 do
      for k := 0 to 1 do
        for l := 0 to 1 do
        begin
          S := '';
          S := Format('Maze4[%d, %d, %d, %d]', [i, j, k, l]);
          S := S + '=>' + IntToStr(Maze4[i, j, k, l]);
          Memo1.Lines.Add(S);
        end;
 
end;

作者:网络 来源:转载
共有评论 0相关评论
发表我的评论
  • 大名:
  • 内容:
  • 盒子文章(www.2ccc.com) © 2020 版权所有 All Rights Reserved.
  • 沪ICP备05001939号