help with program

This is a discussion on help with program within the C Programming forums, part of the General Programming Boards category; i need hints on how to sort a 2-d array of chars of the following format. char names[100][40] strings input ...

  1. #1
    age
    age is offline
    Registered User
    Join Date
    Dec 2003
    Posts
    1

    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
    Posts
    46
    I did a search on yahoo for

    strcmp sort string name

    first link was this page

    http://www-ee.eng.hawaii.edu/Courses...on2.1.3.1.html

    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, 11:04 PM

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