From dad4c342e6a6a1bcb6c861903643ee0028d3ac90 Mon Sep 17 00:00:00 2001 From: Artem Horbunov Date: Wed, 8 Apr 2020 15:54:16 +0000 Subject: [PATCH] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu6/program.c=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du6/program.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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:");