Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hard to do - aritmethic combination.
Message
 
À
28/06/2002 13:55:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00673403
Message ID:
00673431
Vues:
23
Suppose you need to get "m" records out of "n".
Depending on whether the order is sufficient or not, you may use expressions:
n!/(n-m)! or n!/(n-m)!/m!
Here factorial n! means n*(n-1)*(n-2)*...*2*1.

Thus you may use the subprogram to calculate factorials, like:

Function iFactorial
LParameter pX
Local retval,ia
retval=1
if pX>1
for ia=1 to pX
retval=retval*ia
endfor
return retval

>I need to do a function or a prg that get the records from one table and in another table create one record for each possible combination of the records of the first table. Each combination of 2 over n, 3 over n, 4 over n...., n over n, where n is the total of records to be combined.
>Some idea? Thanks for any reply.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform