funguje
This commit is contained in:
parent
7c9f6defed
commit
f65f9c0c03
@ -15,6 +15,11 @@ char* evaluate_expression(char* expression) {
|
||||
return "CHYBA";
|
||||
}
|
||||
|
||||
// Kontrola delenia nulou
|
||||
if (operator == '/' && num2 == 0) {
|
||||
return "ZLE";
|
||||
}
|
||||
|
||||
// Vykonanie operácie a porovnanie s očakávaným výsledkom
|
||||
switch (operator) {
|
||||
case '+':
|
||||
@ -27,10 +32,6 @@ char* evaluate_expression(char* expression) {
|
||||
result = num1 * num2;
|
||||
break;
|
||||
case '/':
|
||||
// Kontrola delenia nulou
|
||||
if (num2 == 0) {
|
||||
return "CHYBA";
|
||||
}
|
||||
result = num1 / num2;
|
||||
break;
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user