maverick786 -2 Newbie Poster

The requirements for my program is to input a set of substrings into a
vector and produce permutations/ combinations of the substrings. The
resulting strings must be an integer multiple of
the length of the inputted substrings. My program only produces
permutations of each
substring with no replicates. i.e I input 'ab cd ef' into a vector
and
6 being the length of the results. The output I'm supposed to get
should be: " ababab ababcd ababef abcdab" ...etc.
My output is : " abcdef abefcd cdabef cdefab efabcd efcdab " . The
next_combination function is not part of the STL which I thought I
could use. Is there anyway to adjust the next_permutation command to
include repititions?? I though about using nested for loops to print
out each vector element; this works but is there a way using STL
functions.This is the repitition code portion:

copy(subString.begin(),subString.end(),ostream_iterator<string>
cout,"")); 
cout << endl; 
 while (next_permutation(subString.begin(), subString.end())) 
{ 
  copy(subString.begin(),subString.end(),ostream_iterator<string>(cout,"")); 
  cout << endl; 
    }

Please, does anyone have a suggestion.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.