I'm making a word unscrambler, an anagram solver of sorts. So, I've stored all possible variations of the word in storedstrings which is an array of strings. Now, i need to delete all the same strings in storedstrings and then store the unique strings in another array of strings. This is my function and it isn't working. Dunno why because it appears correct. Some help please?
//function to delete same strings from storedstrings
void del_duplicate()
{
int i,lim,k,n=0;
lim=factorial(len);
for(i=0;i<lim;i++)
{
for(k=0;k<lim;k++)
{
if(i!=k)
{
if(!(storedstrings[i].compare(storedstrings[k])))
{
storedstrings[k].clear();
}
}
}
}
for(i=0;i<lim;i++)
{
if(!(storedstrings[i].empty()))
newstoredstrings[n++].assign(storedstrings[i]);
cout<<n<<" "<<newstoredstrings[n-1];
}
total=n;
}