diff --git a/du4/program.c b/du4/program.c index b89d25e..75b555a 100644 --- a/du4/program.c +++ b/du4/program.c @@ -46,10 +46,14 @@ int main() { char name[namemax]; if (sscanf(buffer, "%d %99[^\n]", &golosa, name) != 2 || golosa <= 0) { - continue; // Пропускаем ошибочную строку + continue; } - if (find_student(students, count, name) == -1) { + int index = find_student(students, count, name); + + if (index != -1) { + students[index].golosa += golosa; + } else { strcpy(students[count].name, name); students[count].golosa = golosa; count++; @@ -71,3 +75,8 @@ int main() { return 0; } + + + + + diff --git a/du4/program.exe b/du4/program.exe index 29994ab..67c5fae 100644 Binary files a/du4/program.exe and b/du4/program.exe differ