counting each occurenc of each word in a file

This is a discussion on counting each occurenc of each word in a file within the C++ Programming forums, part of the General Programming Boards category; hey fellas: this is a small part of my big project.. need suggestions on how to count all occurences of ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    63

    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...

    thanks!
    SS3X

  2. #2
    Unregistered
    Guest
    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, 08:51 PM
  2. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 09:39 AM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21