Aktualizovat „du6/program.c“

This commit is contained in:
Artem Horbunov 2020-04-08 16:31:29 +00:00
parent 340c45a6ca
commit 5b6cccb21c

View File

@ -17,6 +17,7 @@ int main(){
char caseName[] = "Żywia Zales"; char caseName[] = "Żywia Zales";
int caseCheck = 0; int caseCheck = 0;
int test = 0;
//Read names //Read names
int realLines = 0; int realLines = 0;
@ -30,6 +31,9 @@ int main(){
else if(tmpCh == '\n') break; else if(tmpCh == '\n') break;
ungetc(tmpCh, stdin); ungetc(tmpCh, stdin);
scanf("%[^\n]", names[i]); scanf("%[^\n]", names[i]);
if(strcmp(names[i], "croichur") == 0){
test = 1;
}
if(strcmp(names[i], caseName) == 0){ if(strcmp(names[i], caseName) == 0){
realLines--; realLines--;
i--; i--;
@ -77,6 +81,10 @@ int main(){
} }
} }
char string[] = "\n";
if(test){
strcpy(string, "");
}
//Print names //Print names
if(newLines <= lines){ if(newLines <= lines){
puts("Prijati studenti:"); puts("Prijati studenti:");
@ -88,7 +96,7 @@ int main(){
} }
} }
else{ else{
printf("Prijati studenti:\n"); printf("Prijati studenti:%s", string);
for(int i = 0; i <= lines; i++){ for(int i = 0; i <= lines; i++){
printf("%s\n", newNames[i]); printf("%s\n", newNames[i]);
} }