Обновить cv3/program.c
This commit is contained in:
parent
85f66425f9
commit
cbaea22303
@ -45,6 +45,13 @@ int main() {
|
|||||||
inicStEk(&stek);
|
inicStEk(&stek);
|
||||||
char bufer[256];
|
char bufer[256];
|
||||||
while (fgets(bufer, sizeof(bufer), stdin) != NULL) {
|
while (fgets(bufer, sizeof(bufer), stdin) != NULL) {
|
||||||
|
if (bufer[0] == '\n') {
|
||||||
|
printf("no input\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char* konec;
|
char* konec;
|
||||||
double chislo = strtod(bufer, &konec);
|
double chislo = strtod(bufer, &konec);
|
||||||
char c = konec[0];
|
char c = konec[0];
|
||||||
@ -75,7 +82,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
push(&stek, a / b);
|
push(&stek, a / b);
|
||||||
}
|
}
|
||||||
} else if (isalpha(c)) {
|
} else if (!isdigit(c) || !isalpha(c)) {
|
||||||
printf("bad input\n");
|
printf("bad input\n");
|
||||||
return 0;
|
return 0;
|
||||||
} else{
|
} else{
|
||||||
|
Loading…
Reference in New Issue
Block a user