Initialization
This commit is contained in:
parent
77eea37bb6
commit
2d6971997a
@ -18,6 +18,7 @@ int main() {
|
|||||||
memset(names, 0, sizeof(names));
|
memset(names, 0, sizeof(names));
|
||||||
|
|
||||||
while (fgets(temp_name, sizeof(temp_name), stdin)!= NULL && num_accepted < max_students) {
|
while (fgets(temp_name, sizeof(temp_name), stdin)!= NULL && num_accepted < max_students) {
|
||||||
|
temp_name[strcspn(temp_name, "\n")] = '\0';
|
||||||
|
|
||||||
int i, found = 0;
|
int i, found = 0;
|
||||||
|
|
||||||
@ -40,12 +41,13 @@ int main() {
|
|||||||
} else {
|
} else {
|
||||||
printf("Prijati studenti:");
|
printf("Prijati studenti:");
|
||||||
for (int i = 0; i < num_accepted; i++) {
|
for (int i = 0; i < num_accepted; i++) {
|
||||||
printf("%s", names[i]);
|
printf("%s\n", names[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_students > num_accepted) {
|
if (num_students > num_accepted) {
|
||||||
printf("Neprijati studenti:");
|
printf("Neprijati studenti:");
|
||||||
for (int i = 0; i < num_students; i++) {
|
for (int i = 0; i < num_students; i++) {
|
||||||
|
strcpy(temp_name, names[i]);
|
||||||
int found = 0;
|
int found = 0;
|
||||||
for (int j = 0; j < num_accepted; j++) {
|
for (int j = 0; j < num_accepted; j++) {
|
||||||
if (strcmp(names[j], temp_name) == 0) {
|
if (strcmp(names[j], temp_name) == 0) {
|
||||||
@ -54,7 +56,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
printf("%s", temp_name);
|
printf("%s\n", temp_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user