Update 'cv3/program.c'

This commit is contained in:
Anzhelika Nikolaieva 2023-10-10 18:53:37 +00:00
parent c3a01b6338
commit 047a97232f

View File

@ -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] == '/') {