diff --git a/cv3/program.c b/cv3/program.c index d38ae52..592eaa8 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -26,7 +26,7 @@ int isFull(StEk* stek) { void push(StEk* stek, double chislo) { if (isFull(stek)) { printf("full stack\n"); - exit(1); + return; } stek->chisla[stek->vershina] = chislo; stek->vershina++; @@ -35,7 +35,7 @@ void push(StEk* stek, double chislo) { double pop(StEk* stek) { if (isEmpty(stek)) { printf("not enough operands\n"); - exit(1); + return 0; } return stek->chisla[--stek->vershina]; } @@ -61,6 +61,7 @@ int main() { if (c == '\n' && *bufer != '\n' && *bufer != ' ') { push(&stek, chislo); + } else if (c == '+' || c == '-' || c == '*' || c == '/') { if (isEmpty(&stek)) { printf("not enough operands\n");