Basic Pascal Tutorial/Chapter 5/Multidimensional arrays/fr: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | [[Basic Pascal Tutorial/fr|Tutoriel de Pascal Objet]] : Types de données / **Tableaux multidimensionnels** | |
| 2 | 2 | ||
| 3 | - | ||
| 4 | - | ||
| 5 | - | ||
| 3 | + | Vous pouvez avoir des tableaux à plusieurs dimensions : | |
| 4 | + | ``` | |
| 6 | 5 | type | |
| 7 | - | ||
| 6 | + | datatype = array [enum_type1, enum_type2] of datatype; | |
| 8 | 7 | ``` | |
| 9 | 8 | ||
| 10 | - | ||
| 11 | - | ||
| 12 | - | ||
| 9 | + | La virgule sépare les dimensions et faire référence au tableau, sera fait comme cela : | |
| 10 | + | ``` | |
| 13 | 11 | a [5, 3] | |
| 14 | 12 | ``` | |
| 15 | 13 | ||
| 16 | - | ||
| 17 | - | ||
| 18 | - | ||
| 14 | + | Les tableaux à deux dimensions sont utiles pour les programmeurs de jeux de plateaux. Un plateau de morpion pourrait avoir les déclarations de types et de variables : | |
| 15 | + | ``` | |
| 19 | 16 | type | |
| 20 | - | ||
| 21 | - | ||
| 22 | - | ||
| 23 | - | ||
| 17 | + | StatusType = (X, O, Blank); | |
| 18 | + | BoardType = array[1..3,1..3] of StatusType; | |
| 19 | + | var | |
| 20 | + | Board : BoardType; | |
| 24 | 21 | ``` | |
| 25 | 22 | ||
| 26 | - | ||
| 27 | - | ||
| 28 | - | ||
| 23 | + | Vous pouvez initialiser le plateau avec : | |
| 24 | + | ``` | |
| 29 | 25 | for count1 := 1 to 3 do | |
| 30 | - | ||
| 31 | - | ||
| 26 | + | for count2 := 1 to 3 do | |
| 27 | + | Board[count1, count2] := Blank; | |
| 32 | 28 | ``` | |
| 33 | 29 | ||
| 34 | - | ||
| 30 | + | Vos pouvez, bien sûr, utiliser des tableaux à 3 dimensions ou plus encore. | |
| 35 | 31 | ||
| 32 | + | [[Basic Pascal Tutorial/Chapter 5/1-dimensional arrays/fr|←]] | [[Basic Pascal Tutorial/Contents/fr|Sommaire]] | [[Basic Pascal Tutorial/Chapter 5/Records/fr|→]] | |
| 33 | + | ---|---|--- | |
| 34 | + | ||
| 36 | 35 | --- | |
| 37 | - | ||
| 36 | + | *From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 5/Multidimensional arrays/fr", as the Internet Archive kept it on 2023-03-27. 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).* |
