I need help with my C++ code... This is a simple program that runs, but it has accuracy problems.
I cannot get the total miles per gallon to be accurate with a decimal place. It rounds. For example:
Enter Miles: 21
Enter Gallons: 5
example: I cannot say I traveled 25.5 miles...
I have attached my simple code. Please update it to address the accuracy problems. Please also be sure to comment the code and provide lengthy detail in the cause of the inaccuracy in the original
Miles per Gallon: 4 (which is incorrect)
Also, I am unable to get the code to accept decimal places with the initial input. It will error out.
Get Free Quote!
334 Experts Online