I’m trying to create a program, which would loop trough all letters.
I want for example show aaaa, then aaab to aaaz, then aaba and so on to zzzz.
The problem is: how to allow user to enter the letter count?
Here’s my code with only 3 letters:
Dim abc() As String = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", _
"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
Console.ReadLine()
Dim indx As Integer = 0
For a = 0 To 25
For b = 0 To 25
For c = 0 To 25
Console.WriteLine("{0}{1}{2}", abc(a), abc(b), abc(c))
Next
Next
Next
Recursion is the tool you’re looking for here. You want to repeat to a certain depth; that depth is the input from the user. In this example I’ve provided a depth of 3 (meaning all permutations with three letters, as you described in your question). You can change the value to whatever you wish, or better yet read input from the user.