nechapem erroru, ozatvorkujem co sa da
This commit is contained in:
parent
79f80f9bc9
commit
17ceaae191
@ -9,9 +9,13 @@ int compare(const void* p1, const void* p2) { //bolo v zadani na webe
|
|||||||
struct student* s2 = (struct student*)p2;
|
struct student* s2 = (struct student*)p2;
|
||||||
// s1->votes je počet hlasov
|
// s1->votes je počet hlasov
|
||||||
// s1->name je meno študenta
|
// s1->name je meno študenta
|
||||||
if (s1->votes != s2->votes) return s2->votes - s1->votes;
|
if (s1->votes != s2->votes) {
|
||||||
|
return s2->votes - s1->votes;
|
||||||
|
}
|
||||||
//ak su rozne hlasy, tak vratim indikator ako ich zoradit podla hodnoty
|
//ak su rozne hlasy, tak vratim indikator ako ich zoradit podla hodnoty
|
||||||
else return strcmp (s1->name, s2->name);
|
else {
|
||||||
|
return strcmp (s1->name, s2->name);
|
||||||
|
}
|
||||||
//ak su hlasy rovnake, zistim, ktore meno je hore alebo dole abecedne
|
//ak su hlasy rovnake, zistim, ktore meno je hore alebo dole abecedne
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user