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

This commit is contained in:
Yevhen Kozirovskyi 2024-10-17 16:57:43 +00:00
parent f71ad133b9
commit 7806888c40

View File

@ -47,10 +47,7 @@ int main() {
while (fgets(bufer, sizeof(bufer), stdin) != NULL) {
char* konec;
double chislo = strtod(bufer, &konec);
if (chislo == 0 && strcmp(bufer, "0\n") != 0) {
printf("bad input\n");
exit(1);
}
if (*konec == '\n' && *bufer != '\n' && *bufer != ' ') {
push(&stek, chislo);
} else if (strcmp(konec, "+\n") == 0) {
@ -111,6 +108,7 @@ int main() {
} else if (isalpha(konec[-1])) {
printf("bad input\n");
exit(1);
return 0;
} else {
printf("bad input\n");
exit(1);
@ -122,4 +120,4 @@ int main() {
}
printf("no input\n");
return 0;
}
}