CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 1999
    Posts
    24

    Major Text file problem

    Sorry for the previous Post with my nick as the subject
    Let's say I have a text files with names. I want a program or function to return the names that have the highest count within
    that textfile. The program should return a maximum of four different strings (names). The strings should always be unique.
    If there are less than four different names within a file the program should return less than four.
    Here are some examples to explain my problem:
    #########################
    A text file containing:

    Jack
    John
    Mick

    Should return:

    Jack
    John
    Mick
    #########################
    A text file containing:

    Jack
    John
    John
    Jack
    Mick

    Should return:

    John
    Jack
    Mick

    #########################
    A text file containig:

    Jack
    Jack
    Jack
    John
    John
    Mick
    Buck
    Buck
    Buck
    Trent

    Should return:

    Jack
    John
    Buck
    Trent

    The order of the returned strings doesn't matter that much. The important thing is that the names with the highest count get returned...

    Hope someone can solve this one




  2. #2
    Join Date
    Oct 1999
    Location
    germany
    Posts
    8

    Re: Major Text file problem

    look at your other posting




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured