Initialization

This commit is contained in:
Kozar 2024-04-22 18:04:53 +02:00
parent 157e14f370
commit 4203df9d14

View File

@ -8,6 +8,7 @@ int main() {
int max_students, num_accepted = 0; int max_students, num_accepted = 0;
char names[MAX_STUDENTS][NAME_SIZE]; char names[MAX_STUDENTS][NAME_SIZE];
char temp_name[NAME_SIZE]; char temp_name[NAME_SIZE];
int num_rejected = max_students;
scanf("%d", &max_students); scanf("%d", &max_students);
if (max_students <= 0 || max_students > MAX_STUDENTS) { if (max_students <= 0 || max_students > MAX_STUDENTS) {
@ -40,10 +41,14 @@ int main() {
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", names[i]);
if (i < num_accepted - 1) {
printf("\n");
}
} }
num_rejected -= num_accepted;
} }
if (num_accepted < max_students) { if (num_rejected > 0) {
printf("Neprijati studenti:"); printf("Neprijati studenti:");
for (int i = num_accepted; i < max_students; i++) { for (int i = num_accepted; i < max_students; i++) {
printf("%s", names[i]); printf("%s", names[i]);