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