How to count the number of occurances of all the words in a text file using
"supa" <firstname.lastname@example.org> wrote:
>How to count the number of occurances of all the words in a text file using
You could try:
Decide what characters delimit a word and use strtok() on an input stream
connected to the file to retrieve each word in turn. For each word, determine
whether it is already present in an indexed list of word counts: if so, increment
the count, otherwise add it and set the count to 1. I'll leave you to find
a suitable class for holding the indexed set of word counts - there is a
class perfectly suited.
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL