Answer the question
In order to leave comments, you need to log in
How to iterate over all possible combinations of characters?
Can you please tell me how in C++ you can iterate through all possible combinations of characters?
There is a python code:
from itertools import product
mylist = [str(chr(i)) for i in range(33, 127)]
ofile = open('wordlist.txt', 'w')
for j in range(0, 11):
for chars in product(mylist, repeat = j):
ofile.write(''.join(chars) + '\n')
ofile.close()
Answer the question
In order to leave comments, you need to log in
There is no finished function.
You need to either write a recursive function, or iteratively append to all array elements one element at a time from the making set. Just translate this code to c++.
The recursive function seems to be more friendly to allocations and therefore faster.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question