diff --git a/cv10/program.c b/cv10/program.c index e050364..be56f10 100644 --- a/cv10/program.c +++ b/cv10/program.c @@ -15,7 +15,12 @@ int main() { return 1; } - while (scanf(" %s", temp_name)!= EOF && num_accepted < max_students) { + while (fgets(temp_name, sizeof(temp_name), stdin) != NULL && num_accepted < max_students) { + size_t len = strlen(temp_name); + if (len > 0 && temp_name[len-1] == '\n') { + temp_name[len-1] = '\0'; + } + int i, found = 0; for (i = 0; i < num_accepted; i++) {