void permute(string elems, int mid, int end) { static int count; if (mid == end) { cout << ++count << \" : \" << elems << end
If you are interested in permutation generation I did a research paper on it a while back : http://www.oriontransfer.co.nz/research/permutation-generation
It comes complete with source code, and there are 5 or so different methods implemented.