Thread: counting each occurenc of each word in a file

  1. #1
    Registered User
    Join Date
    Jan 2002

    counting each occurenc of each word in a file

    hey fellas:

    this is a small part of my big project.. need suggestions on how to count all occurences of each word ina file.. sort of a bucket sort of unknown preportions..

    here is what i did and i can't figure out why but it did not work..

    i set up a linked list containing a name and an integer value.. used for a counter.. each time i found a duplicate word by strcmp'n my input to each value in the linked list i'd increment the counter or add a new node.. now that did not work.. i would end up with two nodes for 'jerry' or 'tom'.. for whatever reason...


  2. #2
    your basic algorhythm sounds ok. As usual the problem is usually in the details, or in this case, the implementation. Without seeing code, ain't no way to tell what's going on for sure (and even then sometimes it's just guessing).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need Help Fixing My C Program. Deals with File I/O
    By Matus in forum C Programming
    Replies: 7
    Last Post: 04-29-2008, 07:51 PM
  2. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  5. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM