Thread: Sorting problem

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    2

    Question Sorting problem

    I have an Array foo[50][2][10]

    Basically I have put a list like this in that array:

    Apple 12323
    Banana 1112
    Orange 93
    Car 3432
    Banana 6434
    Apple 8756
    ...
    etc.

    In the first field is the order number, in the second field is either 0 or 1 and in the third field is the Name(0) or the Number(1)
    So then
    foo[0][0] would be Apple
    foo[0][1] would be 12323
    foo[1][0] would be Banana
    ...
    etc.


    What I need to do is sort that array by the number.
    So the list would be:
    Orange 93
    Banana 1112
    Car 3432
    etc...


    I'm stuck and I need help.


    Thank you very much!

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    What have you done so far?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    2
    Nothing that could solve the problem, I'm afraid.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Well, the way it works here [at least when it comes to homework style questions] is that you post some code, and we help you with figuring out what is wrong or how to get to the next step.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sorting problem?
    By audinue in forum C Programming
    Replies: 5
    Last Post: 01-06-2009, 02:16 PM
  2. Array Sorting problem
    By ___________ in forum C++ Programming
    Replies: 4
    Last Post: 07-22-2008, 12:17 AM
  3. What is problem about the sorting?
    By Mathsniper in forum C Programming
    Replies: 2
    Last Post: 04-17-2005, 07:00 AM
  4. Sorting text file problem...
    By John-m in forum C Programming
    Replies: 3
    Last Post: 10-01-2002, 04:51 PM
  5. Sorting array output problem
    By Unregistered in forum C Programming
    Replies: 4
    Last Post: 02-19-2002, 01:44 PM