Thread: help with program

  1. #1
    Registered User
    Join Date
    Dec 2003

    help with program

    i need hints on how to sort a 2-d array of chars of the following format.

    char names[100][40]

    strings input as "last name,first name,age"

    i need to be able to sort by 1) last name, 2) first name, or 3) age

    possible functions to use? strcmp() and strtok()?
    Last edited by age; 12-03-2003 at 06:34 PM.

  2. #2
    Registered User
    Join Date
    Nov 2003
    I did a search on yahoo for

    strcmp sort string name

    first link was this page

    I think it explains most of what you want. You'll have to modify it to sort by anything other than last name. Probably best to make an struct with three members. Then you can sort by any of the members.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 01:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM