From c388fee42434d9ec3e9ef290f6acfef6e1a84b0a Mon Sep 17 00:00:00 2001 From: Oleksandr Hryshchenko Date: Fri, 22 Oct 2021 12:09:25 +0000 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB(?= =?UTF-8?q?=D0=B0)=20=D0=BD=D0=B0=20'cv3/program.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cv3/program.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cv3/program.c b/cv3/program.c index 0ee4298..ee0b55a 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -33,13 +33,13 @@ bool calculatorLogic(char buffer[SIZE][SIZE]){ switch(buffer[currentlyInBuffer][0]){ case '+': - temporaryDecimal = round((atof(buffer[currentlyInBuffer-2]) + atof(buffer[currentlyInBuffer-1]))*100)/100; + temporaryDecimal = round(atof(buffer[currentlyInBuffer-2])*100)/100 + round(atof(buffer[currentlyInBuffer-1])*100)/100; break; case '-': - temporaryDecimal = round((atof(buffer[currentlyInBuffer-2]) - atof(buffer[currentlyInBuffer-1]))*100)/100; + temporaryDecimal = round(atof(buffer[currentlyInBuffer-2])*100)/100 - round(atof(buffer[currentlyInBuffer-1])*100)/100; break; case '*': - temporaryDecimal = round((atof(buffer[currentlyInBuffer-2]) * atof(buffer[currentlyInBuffer-1]))*100)/100; + temporaryDecimal = round(atof(buffer[currentlyInBuffer-2])*100)/100 * round(atof(buffer[currentlyInBuffer-1])*100)/100; break; case '/': if(atof(buffer[currentlyInBuffer-1]) == 0.0) { @@ -47,7 +47,7 @@ bool calculatorLogic(char buffer[SIZE][SIZE]){ return false; } else - temporaryDecimal = round((atof(buffer[currentlyInBuffer-2]) / atof(buffer[currentlyInBuffer-1]))*100)/100; + temporaryDecimal = round(atof(buffer[currentlyInBuffer-2])*100)/100 / round(atof(buffer[currentlyInBuffer-1])*100)/100; } for(int i = currentlyInBuffer-2; currentlyInBuffer > i; currentlyInBuffer--)