diff --git a/cv3/program.c b/cv3/program.c index ac87fc0..6664f3a 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -47,6 +47,10 @@ int main() { char* konec; double chislo = strtod(bufer, &konec); if (*konec == '\n' && *bufer != '\n' && *bufer != ' ') { + if (konec - bufer == 1) { + printf("bad input\n"); + exit(1); + } push(&stek, chislo); } else if (strcmp(konec, "+\n") == 0) { if (isEmpty(&stek)) { @@ -103,7 +107,7 @@ int main() { } push(&stek, a / b); } else { - printf("no input\n"); + printf("bad input\n"); exit(1); } for (int i = 0; i < stek.vershina; i++) {