funguje
This commit is contained in:
		
							parent
							
								
									c34908dce6
								
							
						
					
					
						commit
						3d2a889780
					
				| @ -30,7 +30,7 @@ int read_students(struct Student students[], int max_students) { | ||||
|     while (fgets(line, sizeof(line), stdin) != NULL) { | ||||
|         int votes; | ||||
|         char name[MAX_SIZE]; | ||||
|         // Ak sa nenačítajú dva prvky (počet hlasov a meno), skončíme
 | ||||
|         // Ak sa nenačítajú dva prvky (počet hlasov a meno), ukončíme načítanie
 | ||||
|         if (sscanf(line, "%d %99[^\n]", &votes, name) == 2) { | ||||
|             // Prejdeme všetkých študentov a ak nájdeme rovnaké meno, pripočítame hlasy
 | ||||
|             int found = 0; | ||||
| @ -50,6 +50,9 @@ int read_students(struct Student students[], int max_students) { | ||||
|                     break; // Prekročený maximálny počet študentov
 | ||||
|                 } | ||||
|             } | ||||
|         } else { | ||||
|             // Chyba pri načítaní formátu, ukončíme načítanie
 | ||||
|             break; | ||||
|         } | ||||
|     } | ||||
|     return num_students; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user