mar. 26 mars 2013, 09h57
Gregory
atoutfox.public.association
Re: ca faisait plus de 9 mois que j'n'avais pas programmé
Plus simple
nDiv=3
for i= 1 to 12
? ceiling(i/nDiv), mod(i-1, nDiv)+1
endfor
Et le plus simple
For i = 1 to 12
? tableau[ i ] = .objects[i]
endfor
?tableau( 4 , 3)
ou acopy( voir parametres dans l’aide )
Gregory
"eddymaue" <eddymaue retirer @hotmail.com> wrote in message news:kiqdk6$erl$1@news.niouzes.net...
Pour remplir un tableau d'objets, je n'ai pas besoin des valeurs négatives.
là ou l'emporterais encore Ceiling() en ce qui me concerne , c'est qu'avec un tableau à 3 col "(i,3)" pour un Round(i/3,0) avec i = 1 , le résultat serait 0. Donc pas possible puisque Round() arrondit à l'entier le plus proche
* donc dans mon cas round() est à proscrire puisqu'il arrondit à l'entier le plus proche 1.33 = 1 et 1.66 = 2
* pour remplir mon tableau,
nDiv = 3
For i = 1 to 12
? "tableau( "+ Transform( Ceiling(i/nDiv) ) +" , " + Transform(Mod(i+nDiv-1,nDiv)+1)+") = .objects("+Transform(i)+")"
EndFor
tableau( 1 , 1) = .objects(1)
tableau( 1 , 2) = .objects(2)
tableau( 1 , 3) = .objects(3)
tableau( 2 , 1) = .objects(4)
tableau( 2 , 2) = .objects(5)
tableau( 2 , 3) = .objects(6)
tableau( 3 , 1) = .objects(7)
tableau( 3 , 2) = .objects(8)
tableau( 3 , 3) = .objects(9)
tableau( 4 , 1) = .objects(10)
tableau( 4 , 2) = .objects(11)
tableau( 4 , 3) = .objects(12)
et pour nDiv = 2
tableau( 1 , 1) = .objects(1)
tableau( 1 , 2) = .objects(2)
tableau( 2 , 1) = .objects(3)
tableau( 2 , 2) = .objects(4)
tableau( 3 , 1) = .objects(5)
tableau( 3 , 2) = .objects(6)
tableau( 4 , 1) = .objects(7)
tableau( 4 , 2) = .objects(8)
tableau( 5 , 1) = .objects(9)
tableau( 5 , 2) = .objects(10)
tableau( 6 , 1) = .objects(11)
tableau( 6 , 2) = .objects(12)
et voilà ça me revient tout de même assez bien la gymnastique mental
Permalink : http://www.atoutfox.org/nntp.asp?ID=0000011657