Обновить cv3/program.c

This commit is contained in:
Yevhen Kozirovskyi 2024-10-17 17:51:27 +00:00
parent 85f66425f9
commit cbaea22303

View File

@ -45,6 +45,13 @@ int main() {
inicStEk(&stek);
char bufer[256];
while (fgets(bufer, sizeof(bufer), stdin) != NULL) {
if (bufer[0] == '\n') {
printf("no input\n");
return 0;
}
char* konec;
double chislo = strtod(bufer, &konec);
char c = konec[0];
@ -75,10 +82,10 @@ int main() {
}
push(&stek, a / b);
}
} else if (isalpha(c)) {
} else if (!isdigit(c) || !isalpha(c)) {
printf("bad input\n");
return 0;
} else {
} else{
printf("no input\n");
return 0;
}