Generating character combinations - help!
-
How would I go about writing something that would generate all possible character combinations for a given length and properties, such as uppercase/lowercase/both, numbers/letters/both, etc? For example, if you put in say, 2 digits, it will generate: aa aA ab aB ac aC ... Aa AA Ab AB Ac AC ... etc... Has anyone done this, and if not, how is the best way to do this?
-
How would I go about writing something that would generate all possible character combinations for a given length and properties, such as uppercase/lowercase/both, numbers/letters/both, etc? For example, if you put in say, 2 digits, it will generate: aa aA ab aB ac aC ... Aa AA Ab AB Ac AC ... etc... Has anyone done this, and if not, how is the best way to do this?
Nested loops, or recursion would be the two obvious answers. Why do you need to do this ? Are you trying to crack passwords ? Christian Graus - Microsoft MVP - C++
-
Nested loops, or recursion would be the two obvious answers. Why do you need to do this ? Are you trying to crack passwords ? Christian Graus - Microsoft MVP - C++
-
A nested loop is just something like this for (int i=0;i
-
Nested loops, or recursion would be the two obvious answers. Why do you need to do this ? Are you trying to crack passwords ? Christian Graus - Microsoft MVP - C++
yes indeed, why would you want to do this - maybe it's something as innocent as a class assignment, but maybe not... if it is innocent though, an example in VB like the one above - just in case you are sitting there scratching your head - is as follows:
Dim x, y As Integer 'declare x and y - your counting variables For x = 1 To 20 'anything inside this loop, including the following loop, will be repeated 20 times For y = 1 To 30 'this loop will repeat anything inside it 30 times Next Next
Of course you're not limited to "For" loops; you could use any kind of loop. And if you're still sitting there scratching your head, then you need to learn a little more about programming in general - buy a book or take a class. btw Good luck with those passwords - I mean that assignment. sincerely, Brett Peirce - PolerBear To err is human; To forgive: divine. -- modified at 0:16 Thursday 20th October, 2005