This commit is contained in:
Weber 2024-10-14 11:54:21 +00:00
parent a3ca850437
commit 3f19705323

View File

@ -58,7 +58,8 @@ bool delit(KalkulackaZasobnik *kalkulacka) {
float a, b;
if (vyber(kalkulacka, &a, &b)) {
if (a == 0) {
return false; // Delenie nulou
printf("division by zero\n");
return false;
}
return vloz(kalkulacka, b / a);
}
@ -119,12 +120,10 @@ int main() {
}
break;
case '/':
if (delit(&kalkulacka)) {
zobraz_zasobnik(&kalkulacka);
} else {
printf("division by zero\n");
if (!delit(&kalkulacka)) {
return 0;
}
zobraz_zasobnik(&kalkulacka);
break;
default:
printf("no input\n");