I want to make a program in C that generates a file with all the possible string that have:
2 numbers (from 0 to 9)
and 6 letters (from a to z)
how can I do it?
I can’t find out how many combinations there are too
can you help? thanks a lot
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Devise an algorithm that maps the output you want to a consecutive series of numbers.
Implement that algorithm in code.
Call that algorithm for each number in the series.
For the first number, there are 10 possibilities. For each of those 10 possibilities, there are ten possibilities for the second number, for a total of 100 possibilities for the first two numbers. For each of those 100 possibilities, there are 26 possibilities for the first letter, for a total of 2,600 possibilities for the first three numbers. And so on.
Here’s an alternate method:
Devise an algorithm that puts all the possible legal value in a strict ordering such that there’s a first value, a last value, and every value is greater than or less than every other.
Implement in code a way to produce the “next” value according to your algorithm from step 1.
Go to the first legal value.
Output the value.
If this is the last legal output, stop.
Use the code from step 2 to go to the next value. Go to step 4.
It’s pretty clear what ordering you can use, alphabetical. The first output is “00aaaaaa”. The last is “99zzzzzz”.