A give you a sample code which incidentally (?!) could be used as a building block for your program:
#include <iostream>
#include <vector>
using namespace std;
void produce(const vector<char> & v, string s, size_t index)
{
if ( index == v.size() )
{
cout << s << " ";
return;
}
for ( auto x : v )
{
produce( v, s+x, index + 1);
}
}
int main()
{
string s{};
vector<char> v{'a','b','c'};
produce(v,s,0);
cout << endl;
}