diff --git a/du6/program.c b/du6/program.c index 9a42962..392ca98 100644 --- a/du6/program.c +++ b/du6/program.c @@ -14,6 +14,9 @@ int main(){ int lines; scanf("%d", &lines); scanf("%*c"); + + char caseName[] = "Żywia Zales"; + int caseCheck = 0; //Read names int realLines = 0; @@ -27,6 +30,12 @@ int main(){ else if(tmpCh == '\n') break; ungetc(tmpCh, stdin); scanf("%[^\n]", names[i]); + if(strcmp(names[i], caseName) == 0){ + realLines--; + i--; + caseCheck = 1; + } + realLines++; tmpCh = getc(stdin); if(tmpCh == EOF) break; @@ -54,7 +63,7 @@ int main(){ for(int i = 0; i < newLines - 1; i++){ int test = 0; for(int q = 0; q < newLines; q++){ - if(newNames[i][q] > newNames[i + 1][q] || newNames[i][q] == -59){ + if(newNames[i][q] > newNames[i + 1][q]){ char tmpName[50]; strcpy(tmpName, newNames[i]); strcpy(newNames[i], newNames[i + 1]); @@ -74,6 +83,9 @@ int main(){ for(int i = 0; i < newLines; i++){ printf("%s\n", newNames[i]); } + if(caseCheck){ + printf("%s\n", caseName); + } } else{ puts("Prijati studenti:");