Say I have a two dimensional array. One dimesion with 7 possible values (Y), the other with "X" (any positive integer). Say I want to write to a file every possible combination the X and Y, where every item X has to be used while Y (1-7) may have any amount used. (Imagine a poker machine with "X" number of wheels, with 7 items on each wheel). How do I go about writing an algorithm for that? The writing is trivial but the actual going through of combinations. Because I can only seem to manage when X is a known constant.. Use whatever language (including Pseudo or plain english) if you can help me!