Thread: help w/ program

  1. #16
    Registered User
    Join Date
    Sep 2003
    Posts
    49
    i was thinking of using this...while it is still reading...

    Code:
        int i, pass, hold;
        for (pass = 0; pass <=13; pass++) 
            for (i=0; i<=11; i++)
                if (records[i] > records[i+1]){ 
                    hold = records[i];
                    records[i] = records[i+1];
                    records[i + 1]= hold;
                }

    but I'm thinking that a swap would work better....
    your thoughts?
    Code this

  2. #17
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    If you want to sort by name then you'll have to actually use the name member of the struct in the if(). hold will have to be of the same type that you want to actually temporarily store (struct employee).
    If you understand what you're doing, you're not learning anything.

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