This commit is contained in:
Andrii Hermaniuk 2022-04-22 09:28:51 +02:00
parent 43edbe5a89
commit 4afd416056

View File

@ -12,20 +12,19 @@ int main(){
int pocet_mien_v_poli=0; int pocet_mien_v_poli=0;
int p = 0; int p = 0;
scanf("%d",&p); scanf("%d",&p);
getchar(); getchar();
while(1){ while(1){
char line[SIZE]; char line[SIZE];
memset(line,0,SIZE); memset(line,0,SIZE);
char* r = fgets(line,SIZE,stdin); char* r = fgets(line,SIZE,stdin);
int pocet_znakov=0; int pocet_znakov=0;
if(!r||r[0]=='\n')break; if(!r||r[0]=='\n')break;
else pocet_znakov=strlen(line); else pocet_znakov=strlen(line);
int skip=0;
int skip=0;
for (int i=0;skip==0&&i<pocet_mien_v_poli; i++){ for (int i=0;skip==0&&i<pocet_mien_v_poli; i++){
if (!memcmp(pole_smernikov[i],line,pocet_znakov)){ if (!memcmp(pole_smernikov[i],line,pocet_znakov)){
skip=1; skip=1;
@ -38,7 +37,15 @@ int main(){
} }
} }
qsort(pole_smernikov, pocet_mien_v_poli, sizeof(char*), compare); qsort(pole_smernikov, pocet_mien_v_poli, sizeof(char*), compare);
for(int j = 0; j<pocet_mien_v_poli; j++){
for(int i=0;i<strlen(pole_smernikov[j]);i++){
if((pole_smernikov[j][i]>='a'&&pole_smernikov[j][i]<='z')||(pole_smernikov[j][i]>='A'&&pole_smernikov[j][i]<='Z'))
continue;
else{
printf();
}
}
}
printf("Prijati studenti:\n"); printf("Prijati studenti:\n");
for(int i = 0; i<p && i<pocet_mien_v_poli ;i++) for(int i = 0; i<p && i<pocet_mien_v_poli ;i++)
printf("%s",pole_smernikov[i]); printf("%s",pole_smernikov[i]);