test
This commit is contained in:
		
							parent
							
								
									aa10463424
								
							
						
					
					
						commit
						088648b67c
					
				| @ -1,3 +1,4 @@ | ||||
| 
 | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| @ -26,7 +27,7 @@ int main() { | ||||
|     int student_count = 0; | ||||
| 
 | ||||
|     char line[1024]; | ||||
|     int total_votes = 0;  | ||||
|     int total_votes = 0; // Celkový počet hlasov, ak je iba jeden študent
 | ||||
| 
 | ||||
|     while (fgets(line, sizeof(line), stdin)) { | ||||
|         int vote_count; | ||||
| @ -36,7 +37,7 @@ int main() { | ||||
|         if (student_count == 0) { | ||||
|             total_votes = vote_count; | ||||
|         } else { | ||||
|             int existing_student_index = 0; | ||||
|             int existing_student_index = -1; | ||||
|             for (int i = 0; i < student_count; i++) { | ||||
|                 if (strcmp(students[i].name, name) == 0) { | ||||
|                     existing_student_index = i; | ||||
| @ -44,7 +45,7 @@ int main() { | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             if (existing_student_index != 0) { | ||||
|             if (existing_student_index != -1) { | ||||
|                 students[existing_student_index].vote_count += vote_count; | ||||
|             } else { | ||||
|                 if (student_count >= students_capacity) { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user