kompilator necita s porozumenim, chyba mi ciarka
This commit is contained in:
parent
17ceaae191
commit
15eaa14bfd
@ -4,6 +4,11 @@
|
||||
|
||||
#define SIZE 100
|
||||
|
||||
struct student {
|
||||
char name[SIZE];
|
||||
int votes;
|
||||
};
|
||||
|
||||
int compare(const void* p1, const void* p2) { //bolo v zadani na webe
|
||||
struct student* s1 = (struct student*)p1;
|
||||
struct student* s2 = (struct student*)p2;
|
||||
@ -19,11 +24,6 @@ int compare(const void* p1, const void* p2) { //bolo v zadani na webe
|
||||
//ak su hlasy rovnake, zistim, ktore meno je hore alebo dole abecedne
|
||||
}
|
||||
|
||||
struct student {
|
||||
char name[SIZE];
|
||||
int votes;
|
||||
};
|
||||
|
||||
int main() {
|
||||
|
||||
//premenne
|
||||
@ -53,13 +53,13 @@ int main() {
|
||||
}
|
||||
//zoradit abecedne, potom zoradit mena podla poctov hlasov, poposuvat cisla hore
|
||||
|
||||
qsort(studenti, velkost_zoznamu, velkost_zoznamu - 1, compare);
|
||||
qsort(studenti, velkost_zoznamu, sizeof (struct studenti), compare);
|
||||
|
||||
//vystup vo formate printf("Vysledky:\n"); for i=0 to pocet_studentov
|
||||
//printf("%d %s\n"student[i].votes, student[i].name[i]);
|
||||
|
||||
printf("Vysledky:\n");
|
||||
for (int i = 0; i < velkost_zoznamu; i++) printf ("%d %s\n"studenti[i].votes, studenti[i].name);
|
||||
for (int i = 0; i < velkost_zoznamu; i++) printf ("%d %s\n", studenti[i].votes, studenti[i].name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user