diff --git a/cv3/program.c b/cv3/program.c index b64bce6..6c3313e 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -47,10 +47,7 @@ int main() { while (fgets(bufer, sizeof(bufer), stdin) != NULL) { char* konec; double chislo = strtod(bufer, &konec); - if (chislo == 0 && strcmp(bufer, "0\n") != 0) { - printf("bad input\n"); - exit(1); - } + if (*konec == '\n' && *bufer != '\n' && *bufer != ' ') { push(&stek, chislo); } else if (strcmp(konec, "+\n") == 0) { @@ -111,6 +108,7 @@ int main() { } else if (isalpha(konec[-1])) { printf("bad input\n"); exit(1); + return 0; } else { printf("bad input\n"); exit(1); @@ -122,4 +120,4 @@ int main() { } printf("no input\n"); return 0; -} +} \ No newline at end of file