I got a structure:
typedef struct people
{
char name[50];
int money;
} PEOPLE;
And I have a text file, where are names of the people with their money:
A 3 650
B 7 000
C 5 000
D 857
E 12 000
F 4 780
G 890
.
.
.
In the rest of the code I open the text file with names and money and with the while loop I read the everything in the file till the end.
Now I want to sort them from "best" to "worse" by the amount of their money, so the "best" will be in this case C with 5 000
, then a person with lower money, then anoher with lower....
I found a function qsort()
which I want to use in my program, but I´m not sure how to use it.