I have: 39H4-GTT7-LGLN And I'm trying to find every possible combination of sets. Basically each section is scrambled within itself. So there's only 16 combinations for each section. Example the first section I wrote it out as:
39H4
394H
349H
34H9
49H3
4H93
493H
4H39
9H34
934H
943H
9H43
H493
H934
H394
H439
I'm trying to find these for every section. At the end I think I should have 256 combinations since for each section I combine it with another section. Though I think my math is wrong :S Maybe it's (16*16)^3?
Example:
39H4-GTT7-LGLN
394H-GTT7-LGLN
349H-GTT7-LGLN
34H9-GTT7-LGLN
49H3-GTT7-LGLN
4H93-GTT7-LGLN
493H-GTT7-LGLN
4H39-GTT7-LGLN
9H34-GTT7-LGLN
934H-GTT7-LGLN
943H-GTT7-LGLN
9H43-GTT7-LGLN
H493-GTT7-LGLN
H934-GTT7-LGLN
H394-GTT7-LGLN
H439-GTT7-LGLN
And then I'd start all over for the next section but still include the first. I think this is called nfactorial or permutations or something but I'm not sure.
I started off with this code:
#include <windows.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
using namespace std;
void UnScramble(std::string Code)
{
std::vector<std::string> Elements;
for (int I = 0; I < Code.size(); I++)
if (Code[I] == '-')
Elements.push_back(Code.substr(I - 4, 4));
Elements.push_back(Code.substr(Code.size() - 4, 4));
}
int main()
{
UnScramble("39H4-GTT7-LGLN");
}
before I got frustrated and erased the rest of my code and started writing them out.. So I was to start fresh with my code above but I don't know how to start getting each combination of each section and then to get each combination of all 3.. It's killing my brain.
How do I start? Or better yet Where? I think if I can figure out how to get the 16 combinations for each section, I can do the rest. I was thinking if I get each combination and store them like so:
vector<vector<string>(16)> 2DArrayOfStrings(3); so 3 sets of 16 sets of strings I can iterate it with 3 nested forloops to construct all combinations?