Loop question, factorial?

Hard to describe this problem, but here goes.

I have a 5 element array, let's call it a:
and so we have:

a[0], a[1], a[2], a[3], a[4]

but then i want to rearrange the elements into every single permutation:

ie.

a[0], a[1], a[2], a[4], a[3]
a[0], a[1], a[3], a[2], a[4]
a[0], a[1], a[3], a[4], a[2]

and so on........

but how do i do this?
See also std::next_permutation()

Topic archived. No new replies allowed.