Update 'cv3/program.c'
This commit is contained in:
parent
c3a01b6338
commit
047a97232f
@ -1,6 +1,8 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#define STACK_SIZE 10
|
||||
struct stack_glavny {
|
||||
float data[STACK_SIZE];
|
||||
@ -85,9 +87,9 @@ int main() {
|
||||
|
||||
float value;
|
||||
|
||||
if (sscanf(input, "%f", &value) == 1) {
|
||||
if (sscanf(input, "%f", &value) == 1 && strchr(input, '.') == strrchr(input, '.')) {
|
||||
if (!push(&stack, value)) {
|
||||
//printf("Chyba: Zásobník je plný.\n");
|
||||
printf("bad input\n");
|
||||
break;
|
||||
}
|
||||
} else if (input[0] == '+' || input[0] == '-' || input[0] == '*' || input[0] == '/') {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user