December 2nd, 2012, 10:42 AM
C program ! can any one help
Collect 10 alphabets find out how many valid english words can be made from these alphabets.
December 2nd, 2012, 12:04 PM
Read this first
Make an effort, post what YOU can achieve, then post a meaningful question about some aspect of your program you're actually stuck on.
Posting one sentence demands for homework on a plate will get you nowhere.
December 3rd, 2012, 10:18 PM
i just need a hint .... i tried it ... i got only random number gen,,,, dont knw for alphabets..
December 4th, 2012, 12:16 AM
> i got only random number gen
Well this would be a start.
> dont knw for alphabets..
Do you mean random letters?
char alphabet = "abcde";
int len = strlen(alphabet);
char randomLetter = alphabet[ rand() % len ];
December 4th, 2012, 07:32 AM
yes... i need to generate random alphabets between a-z..
and check how many valid words could be made of those randomly generated alphabets,and check with the dictionary , whether it is an valid word or not...
December 4th, 2012, 07:41 AM
when we execute it other time ... i am getting the same alphabet ....
ch = 'a' + rand() % ('z'-'a');
December 4th, 2012, 08:36 AM
Perhaps you should post a whole program, rather than just one line.
You can make rand() return the same value, by not calling srand() at all, or by calling it too much.
Or there are plenty of other mistakes we could waste time on guessing as well.