Обновить cv3/program.c
This commit is contained in:
parent
f71ad133b9
commit
7806888c40
@ -47,10 +47,7 @@ int main() {
|
|||||||
while (fgets(bufer, sizeof(bufer), stdin) != NULL) {
|
while (fgets(bufer, sizeof(bufer), stdin) != NULL) {
|
||||||
char* konec;
|
char* konec;
|
||||||
double chislo = strtod(bufer, &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 != ' ') {
|
if (*konec == '\n' && *bufer != '\n' && *bufer != ' ') {
|
||||||
push(&stek, chislo);
|
push(&stek, chislo);
|
||||||
} else if (strcmp(konec, "+\n") == 0) {
|
} else if (strcmp(konec, "+\n") == 0) {
|
||||||
@ -111,6 +108,7 @@ int main() {
|
|||||||
} else if (isalpha(konec[-1])) {
|
} else if (isalpha(konec[-1])) {
|
||||||
printf("bad input\n");
|
printf("bad input\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
printf("bad input\n");
|
printf("bad input\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
Loading…
Reference in New Issue
Block a user