From c52a1879d90ec241c4efad7c262905b8a583f760 Mon Sep 17 00:00:00 2001 From: Bohdan Kapliuk Date: Sat, 12 Oct 2024 15:24:40 +0300 Subject: [PATCH] cv3 --- cv3/program.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cv3/program.c b/cv3/program.c index 0fbd54b..8f52936 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -15,12 +15,10 @@ int main(){ memset(&mystack,0,sizeof(struct stack)); char vstup[STACK_SIZE]; int counter = 0; - char str[9]="no input"; - char *istr; while(1){ fgets(vstup, STACK_SIZE, stdin); - istr = strstr(str,vstup); - if(vstup[0] == '\n' || istr != NULL){ + vstup[strcspn(vstup, "\n")] = 0; + if(strlen(vstup) == 0){ break; } if(vstup[0] == '-' || vstup[0] == '+' || vstup[0] == '*' || vstup[0] == '/'){