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

This commit is contained in:
Yevhen Kozirovskyi 2024-10-17 17:59:56 +00:00
parent 80f7810cf7
commit 3acee80c88

View File

@ -26,7 +26,7 @@ int isFull(StEk* stek) {
void push(StEk* stek, double chislo) {
if (isFull(stek)) {
printf("full stack\n");
exit(1);
return;
}
stek->chisla[stek->vershina] = chislo;
stek->vershina++;
@ -35,7 +35,7 @@ void push(StEk* stek, double chislo) {
double pop(StEk* stek) {
if (isEmpty(stek)) {
printf("not enough operands\n");
exit(1);
return 0;
}
return stek->chisla[--stek->vershina];
}
@ -61,6 +61,7 @@ int main() {
if (c == '\n' && *bufer != '\n' && *bufer != ' ') {
push(&stek, chislo);
} else if (c == '+' || c == '-' || c == '*' || c == '/') {
if (isEmpty(&stek)) {
printf("not enough operands\n");