Thread: sorting words

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    36

    sorting words

    Dows anyone have any tips on how to sort a list of words (names) ??? thanx

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    204
    qsort().

  3. #3
    Registered User
    Join Date
    Mar 2005
    Posts
    36
    manually?

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Oh, I don't know. strcmp perhaps?

    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    Registered User
    Join Date
    Mar 2005
    Posts
    36
    Names are normally sorted by sorting the last name (w/ Jr, Sr, III, etc) major, left justifed, and any other (first, middle or initial) asa secord unit, left justified minor.

    Alpha is always sorted left justified as if there were enough blanks following to fill out the compare.

  6. #6
    Registered User
    Join Date
    Mar 2005
    Posts
    36
    Sorry. Mistake. Put the Jr,Sr,III,Esq,etc after the middle initial or name as part of that unit.

    Minor field is sorted first, then the major using a sort method that maintains order - or convert into a single field with major to the left of minor and sort by any method.

    There are too many ways to sort things to describe any here, just use qsort() (a C library function commonly available), or look up other methods on Google.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sorting a file with a lot of words.
    By samus250 in forum C Programming
    Replies: 28
    Last Post: 04-27-2008, 01:36 PM
  2. Problem with malloc() and sorting words from text file
    By goron350 in forum C Programming
    Replies: 11
    Last Post: 11-30-2004, 10:01 AM
  3. New Theme
    By XSquared in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 04-01-2004, 08:00 PM
  4. Sorting words with a fast, effincient sorting method
    By Unregistered in forum C++ Programming
    Replies: 19
    Last Post: 07-12-2002, 04:21 PM