test
This commit is contained in:
parent
c8aacba01c
commit
02eba2d66d
@ -6,11 +6,9 @@
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
int maxStudents;
|
int maxStudents;
|
||||||
printf("Zadajte maximálny počet študentov na prijatie: ");
|
|
||||||
scanf("%d", &maxStudents);
|
scanf("%d", &maxStudents);
|
||||||
|
|
||||||
if (maxStudents <= 0) {
|
if (maxStudents <= 0) {
|
||||||
printf("Nespravny vstup\n");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,13 +24,11 @@ int main() {
|
|||||||
numStudents++;
|
numStudents++;
|
||||||
|
|
||||||
if (numStudents >= MAX_STUDENTS) {
|
if (numStudents >= MAX_STUDENTS) {
|
||||||
printf("Príliš veľa študentov. Zvážte navýšenie MAX_STUDENTS.\n");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numStudents == 0) {
|
if (numStudents == 0) {
|
||||||
printf("Ziadne prihlášky\n");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,13 +44,11 @@ int main() {
|
|||||||
|
|
||||||
qsort(names, numStudents, sizeof(names[0]), strcmp);
|
qsort(names, numStudents, sizeof(names[0]), strcmp);
|
||||||
|
|
||||||
printf("\nPrijati studenti:\n");
|
|
||||||
for (int i = 0; i < maxStudents && i < numStudents; i++) {
|
for (int i = 0; i < maxStudents && i < numStudents; i++) {
|
||||||
printf("%s\n", names[i]);
|
printf("%s\n", names[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numStudents > maxStudents) {
|
if (numStudents > maxStudents) {
|
||||||
printf("\nNeprijati studenti:\n");
|
|
||||||
for (int i = maxStudents; i < numStudents; i++) {
|
for (int i = maxStudents; i < numStudents; i++) {
|
||||||
printf("%s\n", names[i]);
|
printf("%s\n", names[i]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user