From 8c3c003af9474257d1e27271ba8c8da9b29b588a Mon Sep 17 00:00:00 2001 From: Yevhen Kozirovskyi Date: Thu, 17 Oct 2024 16:49:26 +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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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++) {