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

From Free Pascal wiki
Jump to navigationJump to search
m (Text replacement - "Object Pascal Tutorial" to "Basic Pascal Tutorial")
m (Kai Burghardt moved page Multidimensional arrays/fr to Basic Pascal Tutorial/Chapter 5/Multidimensional arrays/fr: tidy up main name space: create subpage hierarchy for basic Pascal tutorial [cf. [[Sp...)
(No difference)

Revision as of 03:55, 3 February 2022

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

Tutoriel de Pascal Objet : Types de données / Tableaux multidimensionnels

Vous pouvez avoir des tableaux à plusieurs dimensions :

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

La virgule sépare les dimensions et faire référence au tableau, sera fait comme cela :

a [5, 3]

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 :

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

Vous pouvez initialiser le plateau avec :

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

Vos pouvez, bien sûr, utiliser des tableaux à 3 dimensions ou plus encore.

Sommaire