View Full Version : Help with C prog..need to count unique words

12-08-2004, 01:30 AM
Hi, I need to count and print the number of words and unique words in a text file. This is a C program.

so far i've only been able to count and print the total number of words read in from a text file. i did it using strtok().

but now i have a problem with counting and printing the number of unique words in the file.
1. all punctuation n spaces to be ignored
2. assumed no word longer than 20 characters
3. case insensitive

any help would be appreciated. thank you!

12-08-2004, 03:02 AM
as it says in the rules we don't do homework problems here, we will only help with your solution, if you need help getting started then thats what you need to ask.

you might try using a subString to hold the first word and compare that to every other word then move on to the next word anc continue till the end. This is a brute force way and will be ugly but will get the job done.


12-08-2004, 09:14 AM
thks, that did help a little... :thumbsup: