Изменил(а) на 'cv3/program.c'
This commit is contained in:
parent
93c9fc3f3a
commit
e6c2f23cc6
@ -48,13 +48,13 @@ bool calculatorLogic(char buffer[SIZE][SIZE]){
|
||||
temporaryDecimal = round((atof(buffer[currentlyInBuffer-2]) / atof(buffer[currentlyInBuffer-1]))*100)/100;
|
||||
}
|
||||
|
||||
for(int i = currentlyInBuffer-3; currentlyInBuffer > i; currentlyInBuffer--)
|
||||
memset(buffer[currentlyInBuffer], SIZE, '\0');
|
||||
for(int i = currentlyInBuffer-2; currentlyInBuffer > i; currentlyInBuffer--)
|
||||
memset(buffer[currentlyInBuffer], '\0', SIZE);
|
||||
|
||||
gcvt(temporaryDecimal, 10, buffer[currentlyInBuffer++]);
|
||||
|
||||
for(int i = 0; i <= currentlyInBuffer; i++){
|
||||
if(i == currentlyInBuffer)
|
||||
for(int i = 0; i < currentlyInBuffer; i++){
|
||||
if(i == currentlyInBuffer-1)
|
||||
printf("%0.2f \n", roundf(atof(buffer[i]) * 100) / 100);
|
||||
else
|
||||
printf("%0.2f ", roundf(atof(buffer[i]) * 100) / 100);
|
||||
@ -64,6 +64,7 @@ bool calculatorLogic(char buffer[SIZE][SIZE]){
|
||||
}
|
||||
else{
|
||||
printf("bad input\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,4 +81,4 @@ int main() {
|
||||
printf("no input\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user