From 4c98f69b4ddc69a1a8afad98899d692228dc1269 Mon Sep 17 00:00:00 2001 From: Oleksandr Hryshchenko Date: Fri, 22 Oct 2021 12:15:27 +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 ee0b55a..cfa8f82 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])*100)/100 + round(atof(buffer[currentlyInBuffer-1])*100)/100; + temporaryDecimal = (double)(round(atof(buffer[currentlyInBuffer-2])*100)/100) + (double)(round(atof(buffer[currentlyInBuffer-1])*100)/100); break; case '-': - temporaryDecimal = round(atof(buffer[currentlyInBuffer-2])*100)/100 - round(atof(buffer[currentlyInBuffer-1])*100)/100; + temporaryDecimal = (double)(round(atof(buffer[currentlyInBuffer-2])*100)/100) - (double)(round(atof(buffer[currentlyInBuffer-1])*100)/100); break; case '*': - temporaryDecimal = round(atof(buffer[currentlyInBuffer-2])*100)/100 * round(atof(buffer[currentlyInBuffer-1])*100)/100; + temporaryDecimal = (double)(round(atof(buffer[currentlyInBuffer-2])*100)/100) * (double)(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])*100)/100 / round(atof(buffer[currentlyInBuffer-1])*100)/100; + temporaryDecimal = (double)(round(atof(buffer[currentlyInBuffer-2])*100)/100) / (double)(round(atof(buffer[currentlyInBuffer-1])*100)/100); } for(int i = currentlyInBuffer-2; currentlyInBuffer > i; currentlyInBuffer--)