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