Update 'cv3/program.c'
This commit is contained in:
parent
15c24a4fca
commit
c43770114e
@ -50,22 +50,22 @@ int operation_insert_result(struct stack_glavny* stack, char operation) {
|
||||
break;
|
||||
case '/':
|
||||
if (operand2 == 0) {
|
||||
printf("Chyba: Delenie nulou.\n");
|
||||
//printf("Chyba: Delenie nulou.\n");
|
||||
return false;
|
||||
}
|
||||
result = operand1 / operand2;
|
||||
break;
|
||||
default:
|
||||
printf("Chyba: Neplatná operácia.\n");
|
||||
//printf("Chyba: Neplatná operácia.\n");
|
||||
return false;
|
||||
}
|
||||
if (!push(stack, result)) {
|
||||
printf("Chyba: Zásobník je plný.\n");
|
||||
//printf("Chyba: Zásobník je plný.\n");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
printf("Chyba: Nedostatok operandov pre operáciu.\n");
|
||||
//printf("Chyba: Nedostatok operandov pre operáciu.\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -88,7 +88,7 @@ int main() {
|
||||
|
||||
if (sscanf(input, "%f", &value) == 1) {
|
||||
if (!push(&stack, value)) {
|
||||
printf("Chyba: Zásobník je plný.\n");
|
||||
//printf("Chyba: Zásobník je plný.\n");
|
||||
break;
|
||||
}
|
||||
} else if (input[0] == '+' || input[0] == '-' || input[0] == '*' || input[0] == '/') {
|
||||
@ -96,7 +96,7 @@ int main() {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
printf("Chyba: Neplatný vstup.\n");
|
||||
//printf("Chyba: Neplatný vstup.\n");
|
||||
break;
|
||||
}
|
||||
for (int i = 0; i <= stack.size; i++) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user