funguje
This commit is contained in:
parent
7900f4a220
commit
c8e58d8048
@ -50,10 +50,22 @@ int main() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Pridanie študenta do databázy
|
||||
strcpy(database[size].name, name);
|
||||
database[size].votes = votes;
|
||||
size++;
|
||||
// Hľadanie študenta v databáze
|
||||
int found = 0;
|
||||
for (int j = 0; j < size; j++) {
|
||||
if (strcmp(database[j].name, name) == 0) {
|
||||
database[j].votes += votes;
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Pridanie nového študenta do databázy
|
||||
if (!found) {
|
||||
strcpy(database[size].name, name);
|
||||
database[size].votes = votes;
|
||||
size++;
|
||||
}
|
||||
}
|
||||
|
||||
// Zoradenie databázy podľa počtu hlasov a abecedne
|
||||
|
Loading…
Reference in New Issue
Block a user