oooodchod

This commit is contained in:
Tančáková 2024-03-20 17:49:34 +01:00
parent 5fad030cbc
commit 48b462db74

View File

@ -19,9 +19,9 @@ void initialize_database(struct student* database, int size, char* names[], int*
int main() { int main() {
struct student database[SIZE]; struct student database[SIZE];
memset(database, 0, SIZE * sizeof(struct student)); memset(database, 0, SIZE * sizeof(struct student));
int size = 8; // Veľkosť databázy mien študentov int size = 9; // Veľkosť databázy mien študentov
char* names[8] = {"Bardos Mrtakrys", "Rita Umhi", "Prylenn Alak", "Lak'hi Elavorg", "Prylenn Alak", "Prylenn Alak", "Prylenn Alak", "Rita Umhi"}; char* names[9] = {"Bardos Mrtakrys", "Rita Umhi", "Prylenn Alak", "Lak'hi Elavorg", "Prylenn Alak", "Prylenn Alak", "Prylenn Alak", "Rita Umhi", "Terian Dis"};
int votes[8] = {2, 1, 1, 10, 3, 3, 3, 1}; // Počet hlasov pre každého študenta int votes[9] = {2, 1, 1, 10, 3, 3, 3, 1, 10}; // Počet hlasov pre každého študenta
initialize_database(database, size, names, votes); // Inicializácia databázy mien študentov initialize_database(database, size, names, votes); // Inicializácia databázy mien študentov
@ -31,14 +31,6 @@ int main() {
printf("%d %s\n", database[i].votes, database[i].name); printf("%d %s\n", database[i].votes, database[i].name);
} }
// Vypočítanie celkového počtu hlasov v ankete
int total_votes = 0;
for (int i = 0; i < size; i++) {
total_votes += database[i].votes;
}
printf("\nCelkovy pocet hlasov v ankete: %d\n", total_votes);
return 0; return 0;
} }