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--)