This commit is contained in:
Valér Jakubčo 2021-10-22 00:12:54 +02:00
parent b21c094531
commit 6ebca183a1

View File

@ -1,3 +1,4 @@
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
@ -14,7 +15,6 @@ struct stack{
void print_stack(struct stack* stack);
void push_stack(struct stack* stack, float value);
float pop_stack(struct stack* stack);
int count_stack(struct stack* stack);
@ -74,19 +74,23 @@ int main(){
print_stack(&myStack);
printf("\n");
}
} else if(isdigit(char_value[0]) != 0 ){
float_value = strtof(char_value, NULL);
//printf("float value: %f\n",float_value);
if(float_value == 0){
puts("bad input");
break;
} else {
push_stack(&myStack,float_value);
print_stack(&myStack);
printf("\n");
continue;
}
} else {
float_value = strtof(char_value, NULL);
if(float_value == 0){
puts("bad input");
break;
} else {
push_stack(&myStack,float_value);
print_stack(&myStack);
printf("\n");
continue;
}
}
}else {
puts("bad input");
break;
}
} else {
//push_stack(&myStack, float_value);
//print_stack(&myStack);
//printf("\n");