I am trying to do the following on my computer but not getting it to perform, like say I have a name of a person and I want to make a different combinations of the letters in his name:
NAME ABC
ABC
/ | \
A B C
/|\ / | \ /| \
AA AB AC BA BB BC CA CB CC
. . .
. . .
I want to make combinations of the above name, for example:
ABC A B C AA AB AC BA BB BC CA CB CC.... AAA... BBB... CCC...
How can I do this in C++?
I wrote the following code for it:
string c = "ABC";
for (i = 0; i < c.length(); i++)
c.at(i);
But it only generated A, B, C. How do I generate AB, AA, AC, ...?
CBA, BAC, etc.? Or did you just want two-letter combinations? The good news is the code you have is the building block for the rest of the algorithm. You definitely need to write some pseudocode or even draw on paper what you think should happen.