From 3acee80c884b17a648f8c9c0e4d1ea64a68eedfc Mon Sep 17 00:00:00 2001 From: Yevhen Kozirovskyi Date: Thu, 17 Oct 2024 17:59:56 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20cv3/program.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cv3/program.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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");