Forums: » Register « |  Free Tools |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

New Free Tools on Dev Shed!

#1
December 2nd, 2012, 11:42 AM
 anupsg
Registered User

Join Date: Dec 2012
Posts: 4
Time spent in forums: 31 m
Reputation Power: 0
C program ! can any one help

Collect 10 alphabets find out how many valid english words can be made from these alphabets.

#2
December 2nd, 2012, 01:04 PM
 salem
Contributed User

Join Date: Jun 2005
Posts: 4,247
Time spent in forums: 2 Months 4 Weeks 1 Day 11 h 34 m
Reputation Power: 1809
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.
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper

#3
December 3rd, 2012, 11:18 PM
 anupsg
Registered User

Join Date: Dec 2012
Posts: 4
Time spent in forums: 31 m
Reputation Power: 0
i just need a hint .... i tried it ... i got only random number gen,,,, dont knw for alphabets..

#4
December 4th, 2012, 01:16 AM
 salem
Contributed User

Join Date: Jun 2005
Posts: 4,247
Time spent in forums: 2 Months 4 Weeks 1 Day 11 h 34 m
Reputation Power: 1809
> i got only random number gen
Well this would be a start.

> dont knw for alphabets..
Do you mean random letters?

Perhaps
Code:
```char alphabet[] = "abcde";
int len = strlen(alphabet);
char randomLetter = alphabet[ rand() % len ];```

#5
December 4th, 2012, 08:32 AM
 anupsg
Registered User

Join Date: Dec 2012
Posts: 4
Time spent in forums: 31 m
Reputation Power: 0
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...

#6
December 4th, 2012, 08:41 AM
 anupsg
Registered User

Join Date: Dec 2012
Posts: 4
Time spent in forums: 31 m
Reputation Power: 0
when we execute it other time ... i am getting the same alphabet ....
Code:
`ch = 'a' + rand() % ('z'-'a');`

#7
December 4th, 2012, 09:36 AM
 salem
Contributed User

Join Date: Jun 2005
Posts: 4,247
Time spent in forums: 2 Months 4 Weeks 1 Day 11 h 34 m
Reputation Power: 1809
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.

 Viewing: Dev Shed Forums > Programming Languages > C Programming > C program ! can any one help