diff --git a/cv3/program.c b/cv3/program.c index aee9825..0ee4298 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -53,10 +53,10 @@ bool calculatorLogic(char buffer[SIZE][SIZE]){ for(int i = currentlyInBuffer-2; currentlyInBuffer > i; currentlyInBuffer--) memset(buffer[currentlyInBuffer], '\0', SIZE); - gcvt(temporaryDecimal, 10, buffer[currentlyInBuffer++]); + gcvt(temporaryDecimal, 10, buffer[currentlyInBuffer]); - for(int i = 0; i < currentlyInBuffer; i++){ - if(i == currentlyInBuffer-1) + for(int i = 0; i <= currentlyInBuffer; i++){ + if(i == currentlyInBuffer) printf("%0.2f \n", roundf(atof(buffer[i]) * 100) / 100); else printf("%0.2f ", roundf(atof(buffer[i]) * 100) / 100);