Изменил(а) на 'cv3/program.c'

This commit is contained in:
Oleksandr Hryshchenko 2021-10-22 11:53:40 +00:00
parent e6c2f23cc6
commit 3abd673a7d

View File

@ -42,8 +42,10 @@ bool calculatorLogic(char buffer[SIZE][SIZE]){
temporaryDecimal = round((atof(buffer[currentlyInBuffer-2]) * atof(buffer[currentlyInBuffer-1]))*100)/100;
break;
case '/':
if(atof(buffer[currentlyInBuffer-1]) == 0.0)
if(atof(buffer[currentlyInBuffer-1]) == 0.0) {
printf("division by zero\n");
return false;
}
else
temporaryDecimal = round((atof(buffer[currentlyInBuffer-2]) / atof(buffer[currentlyInBuffer-1]))*100)/100;
}