C++ code... This is a simple program that runs, but it has accuracy problems.

computer science

Description

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 code and the approach used to fix this problem so I understand why. (Just add a large note at the end of the code. A paragraph or two is what I am expecting)

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.


Related Questions in computer science category