You can solve this problem by taking advantage of some general-purpose algorithms from the standard library. The simplest of the two required versions is the non-recursive one, at least when you use std::next_permutation(). This function transforms the input range (that is required to be sorted) into the next permutation from the set of all possible permutations, ordered lexicographically with operator< or the specified comparison function object. If such a permutation exists then it returns true, otherwise, it transforms the range into the first permutation and returns false. Therefore, a non-recursive implementation based on std::next_permuation() looks like this:
void print_permutations(std::string ...