cv5
This commit is contained in:
parent
60852f0d1a
commit
515acee63a
@ -47,7 +47,7 @@ int main() {
|
||||
}
|
||||
|
||||
// Načítanie počtu hlasov a mena zo vstupu
|
||||
if (sscanf(line, "%d %s", &votes, name) != 2) {
|
||||
if (sscanf(line, "%d %[^\n]", &votes, name) != 2) {
|
||||
printf("Invalid input. Please try again.\n");
|
||||
continue;
|
||||
}
|
||||
@ -73,9 +73,9 @@ int main() {
|
||||
qsort(database, size, sizeof(struct student), compare);
|
||||
|
||||
// Výpis triedenej databázy
|
||||
printf("\nSorted database:\n");
|
||||
printf("\nResults:\n");
|
||||
for (int i = 0; i < size; i++) {
|
||||
printf("%s: %d votes\n", database[i].name, database[i].votes);
|
||||
printf("%d %s\n", database[i].votes, database[i].name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user