Possible duplicate:
C ++ sort with structs
I am trying to figure out how to sort an array of structures in a specific variable in a structure stored in an array. Here is my code:
struct Process{ int pid; int burst; int arrival; }; int main(int argc, char *argv[]){
I would really like to be able to sort the array in my code by arrival time. I simplified my code to give you a general idea of ββwhat I'm trying to accomplish. In my actual code, the array array is populated dynamically from the information read by the file. I know that using a list or even a vector would be a better option, but I decided to deal with arrays.
Any help in sorting would be appreciated! :)
source share