From 204652d77209e40fb7b3d5c9ed33abb106983e56 Mon Sep 17 00:00:00 2001 From: Marat Izmailov Date: Thu, 17 Oct 2024 11:30:23 +0000 Subject: [PATCH] Update cv3/program.c --- cv3/program.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/cv3/program.c b/cv3/program.c index 3f668cd..9bfae3f 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -30,17 +30,14 @@ int main() { input[strcspn(input, "\n")] = 0; if (strlen(input) == 0) { - - printf("no input\n"); + printf("no input\n"); break; } if (is_number(input)) { - float value = atof(input); push_stack(&mystack, value); } else if (strlen(input) == 1 && strchr("+-*/", input[0])) { - if (mystack.size < 2) { fprintf(stderr, "Error: Not enough values in stack.\n"); exit(EXIT_FAILURE); @@ -76,13 +73,13 @@ int main() { exit(EXIT_FAILURE); } - print_stack(&mystack); } return 0; } + void push_stack(struct stack* stack, float value) { assert(stack->size < STACK_SIZE); stack->values[stack->size] = value;