You still need to call your function from main(). In main, simply initialise and assign three double variables and pass them into your function.
In main() something like this cout << mpg(d1, d2, d3) << " mpg.\n"; Note, d1, d2 & d3 are the three variables previously initialised and assigned.
We're not bothered about user input at this stage, the whole point is merely to test that your functions works. I can tell you that your function is correct but you need to test it for yourself.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.