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;
|
|
|
|
}
|
2023-04-15 09:56:12 +00:00
|
|
|
int index=0;
|
|
|
|
|
2023-04-15 09:30:03 +00:00
|
|
|
puts("Prijati studenti:");
|
|
|
|
for(int i=0; i<pocet; i++){
|
2023-04-15 09:56:12 +00:00
|
|
|
while(strcmp(mena[index], mena[index +1])==0){
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
if(index>=pocet_mien){
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
printf("%s\n", mena[index]);
|
|
|
|
index++;
|
|
|
|
|
2023-04-15 09:12:14 +00:00
|
|
|
}
|
2023-04-15 09:30:03 +00:00
|
|
|
if(pocet<pocet_mien){
|
|
|
|
puts("Neprijati studenti:");
|
|
|
|
for(int i=pocet; i<pocet_mien; i++){
|
2023-04-15 09:56:12 +00:00
|
|
|
while(strcmp(mena[index], mena[index +1])==0){
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
if(index>=pocet_mien){
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
printf("%s\n", mena[index]);
|
|
|
|
index++;
|
2023-04-15 09:30:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-15 09:56:12 +00:00
|
|
|
|
2023-04-15 09:30:03 +00:00
|
|
|
|
2023-04-15 09:12:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|