Difference between revisions of "Basic Pascal Tutorial/Chapter 5/Multidimensional arrays/ja"

From Free Pascal wiki
Jump to navigationJump to search
(bypass redirects [cf. discussion])
m (bypass language bar/categorization template redirect [cf. discussion])
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Multidimensional arrays}}
+
{{Basic Pascal Tutorial/Chapter 5/Multidimensional arrays}}
  
 
5D - 多次元配列 (著者: Tao Yue, 状態: 原文のまま変更なし)
 
5D - 多次元配列 (著者: Tao Yue, 状態: 原文のまま変更なし)
Line 33: Line 33:
 
{|style=color-backgroud="white" cellspacing="20"
 
{|style=color-backgroud="white" cellspacing="20"
 
|[[Basic Pascal Tutorial/Chapter 5/1-dimensional arrays/ja|previous]]   
 
|[[Basic Pascal Tutorial/Chapter 5/1-dimensional arrays/ja|previous]]   
|[[Contents/ja|contents]]  
+
|[[Basic Pascal Tutorial/Contents/ja|contents]]  
 
|[[Basic Pascal Tutorial/Chapter 5/Records/ja|next]]
 
|[[Basic Pascal Tutorial/Chapter 5/Records/ja|next]]
 
|}
 
|}

Latest revision as of 16:20, 20 August 2022

български (bg) English (en) français (fr) 日本語 (ja) 中文(中国大陆)‎ (zh_CN)

5D - 多次元配列 (著者: Tao Yue, 状態: 原文のまま変更なし)

多次元の配列を扱うこともできる。

type
  datatype = array [enum_type1, enum_type2] of datatype;

カンマで次元を分け、配列は次のように示せる。

a [5, 3]

2次元配列はボードゲームをプログラミングするときに役立つ。3目並べのボードでは以下のタイプと変数宣言をする。

type
  StatusType = (X, O, Blank);
  BoardType = array[1..3,1..3] of StatusType;
var
  Board : BoardType;

ボードは次のように初期化できる。

for count1 := 1 to 3 do
  for count2 := 1 to 3 do
    Board[count1, count2] := Blank;

もちろん、3次元やさらに高次の配列も利用できる。

previous contents next