diff --git a/cv3/program.c b/cv3/program.c index c6294d5..5335c75 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -42,7 +42,7 @@ int main(){ if(char_value[0] == '-'){ float a = pop_stack(&myStack); float b = pop_stack(&myStack); - float c = a-b; + float c = b-a; push_stack(&myStack, c); print_stack(&myStack); printf("\n"); @@ -70,6 +70,7 @@ int main(){ printf("\n"); } }else{ + puts("no input"); break; } } @@ -79,9 +80,8 @@ int main(){ } void print_stack(struct stack* stack){ - printf(">"); for(int i = 0; i < stack->size; i++){ - printf(" %f ",stack->values[i]); + printf("%.2f ",stack->values[i]); } }