2023-04-15 09:12:14 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2023-04-15 09:30:03 +00:00
|
|
|
int porovnavacka(const void *meno1, const void *meno2){
|
|
|
|
return strcmp(meno1, meno2);
|
|
|
|
|
|
|
|
}
|
2023-04-15 09:12:14 +00:00
|
|
|
|
|
|
|
int main(){
|
|
|
|
int pocet=0;
|
|
|
|
char mena[50][50];
|
|
|
|
char riadok[50];
|
|
|
|
int pocet_mien=0;
|
|
|
|
|
|
|
|
scanf("%d\n", &pocet);
|
|
|
|
while(fgets(riadok,50,stdin)!=NULL && riadok[0]!='\n'){
|
|
|
|
if(riadok[strlen(riadok)-1]=='\n'){
|
|
|
|
riadok[strlen(riadok)-1]='\0';
|
|
|
|
}
|
|
|
|
strcpy(mena[pocet_mien],riadok);
|
|
|
|
pocet_mien++ ;
|
|
|
|
}
|
2023-04-15 09:30:03 +00:00
|
|
|
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++){
|
2023-04-15 09:12:14 +00:00
|
|
|
printf("%s\n", mena[i]);
|
|
|
|
}
|
2023-04-15 09:30:03 +00:00
|
|
|
if(pocet<pocet_mien){
|
|
|
|
puts("Neprijati studenti:");
|
|
|
|
for(int i=pocet; i<pocet_mien; i++){
|
|
|
|
printf("%s\n", mena[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-04-15 09:12:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|