nekinox
Messages postés15Date d'inscriptionmercredi 19 février 2003StatutMembreDernière intervention22 mai 2005
-
18 mai 2005 à 16:10
nekinox
Messages postés15Date d'inscriptionmercredi 19 février 2003StatutMembreDernière intervention22 mai 2005
-
22 mai 2005 à 18:35
Bonjour.
Ma question porte sur le nom des variables.
En effet dans mon programme j'utilise plusieurs tableaux noté Grid1, Grid2, Grid3,...., GridN des tableaux d'integer.
J'aimerais faire une procédure générale qui agisse sur Gridi comme par exemple Gridi[x,y]:=50; qui s'appellerais proc50
et tel que dans mon programme quand je tappe proc50(11); alors il m'effectue Grid11[x,y]:=50; ou quand je tappe proc50(27); il m'effectue Grid27[x,y]:=50;
WhiteHippo
Messages postés1154Date d'inscriptionsamedi 14 août 2004StatutMembreDernière intervention 5 avril 20123 18 mai 2005 à 17:02
Simplement et rapidement, j'aurias ecris :
const
MAX_G = 100 ; // Nombre de grilles
MAX_X = 200 ;
MAX_Y = 300 ;
var
Grid : array[1..MAX_G,1..MAX_X,1..MAX_Y] of integer ;
procedure proc50 ( const Index, x, y : integer ) ;
begin
if ( ( Index >= 1 ) and ( Index <= MAX_G ) )
and ( ( x >= 1 ) and ( x <= MAX_X ) )
and ( ( y >= 1 ) and ( y <= MAX_Y ) )
then
begin
Grid[Index][x,y] := 50 ;
end ;
end ;