This commit is contained in:
Patrik Seman 2023-04-15 11:30:03 +02:00
parent c0abcbca6e
commit 78d996f608
2 changed files with 18 additions and 1 deletions

Binary file not shown.

View File

@ -1,6 +1,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int porovnavacka(const void *meno1, const void *meno2){
return strcmp(meno1, meno2);
}
int main(){
int pocet=0;
@ -16,9 +20,22 @@ int main(){
strcpy(mena[pocet_mien],riadok);
pocet_mien++ ;
}
for(int i=0; i<pocet_mien; i++){
qsort(mena, pocet_mien, sizeof(mena[0]), porovnavacka);
if(pocet>pocet_mien){
pocet=pocet_mien;
}
puts("Prijati studenti:");
for(int i=0; i<pocet; i++){
printf("%s\n", mena[i]);
}
if(pocet<pocet_mien){
puts("Neprijati studenti:");
for(int i=pocet; i<pocet_mien; i++){
printf("%s\n", mena[i]);
}
}
return 0;