CSDN博客

img jacky_shen

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

发表于2004/6/23 11:10:00  1161人阅读

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 0

相关文章推荐

img
取 消
img