uprava outputu

This commit is contained in:
Valér Jakubčo 2021-10-21 22:21:32 +02:00
parent 9786b86b3f
commit 364b136792

View File

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