Sign in Join
Wiki copytemporary

Basic Pascal Tutorial/Chapter 5/Multidimensional arrays/ja: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Basic Pascal Tutorial/Chapter 5/Multidimensional arrays/ja

OldNewLine
1+5D - 多次元配列 (著者: Tao Yue, 状態: 原文のまま変更なし)
2+
3+多次元の配列を扱うこともできる。
4+
5+``` pascal
6+type
7+ datatype = array [enum_type1, enum_type2] of datatype;
8+```
9+
10+カンマで次元を分け、配列は次のように示せる。
11+
12+``` pascal
13+a [5, 3]
14+```
15+
16+2次元配列はボードゲームをプログラミングするときに役立つ。3目並べのボードでは以下のタイプと変数宣言をする。
17+
18+``` pascal
19+type
20+ StatusType = (X, O, Blank);
21+ BoardType = array[1..3,1..3] of StatusType;
22+var
23+ Board : BoardType;
24+```
25+
26+ボードは次のように初期化できる。
27+
28+``` pascal
29+for count1 := 1 to 3 do
30+ for count2 := 1 to 3 do
31+ Board[count1, count2] := Blank;
32+```
33+
34+もちろん、3次元やさらに高次の配列も利用できる。
35+
36+| | | |
37+|----|----|----|
38+| [[Basic Pascal Tutorial/Chapter 5/1-dimensional arrays/ja|previous]] | [[Basic Pascal Tutorial/Contents/ja|contents]] | [[Basic Pascal Tutorial/Chapter 5/Records/ja|next]] |
39+
40+---
41+*From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 5/Multidimensional arrays/ja", as it stood on 2022-08-20 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history