Изменил(а) на 'du5/program.c'
This commit is contained in:
parent
d50e21770b
commit
bf947abf89
@ -43,6 +43,7 @@ int compare_students(const void* a, const void* b) {
|
||||
|
||||
int main(){
|
||||
int STOP = 0;
|
||||
int counter = 0;
|
||||
struct student databaza[SIZE];
|
||||
memset(databaza, 0, SIZE*sizeof(struct student));
|
||||
int size = 0;
|
||||
@ -86,14 +87,19 @@ int main(){
|
||||
else {
|
||||
databaza[id].votes += value;
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
|
||||
qsort(databaza, size, sizeof(struct student), compare_students);
|
||||
|
||||
if(counter != 0){
|
||||
printf("Vysledky:\n");
|
||||
for (int i = 0; i < size; i++) {
|
||||
printf("%d", databaza[i].votes);
|
||||
printf(" %s\n", databaza[i].name);
|
||||
}
|
||||
}
|
||||
else{
|
||||
printf("Nepodarilo nacitat nic\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user