PLEASE HELP!!! A liter is 0.264179 gallons. Write a program that will read in th
ID: 3616685 • Letter: P
Question
PLEASE HELP!!!A liter is 0.264179 gallons. Write a program that will read in thenumber of liters of gasoline consumed by the user's car and thenumber of miles traveled by the car, and will then output thenumber of miles per gallon the car delivered. Your program shouldallow the user to repeat this calculation as often as the userwishes. Define 3 functions: one to take input from the user (usingpass by reference formal parameters),another to compute the numberof miles per gallon, and finally another to display the output.Your program should use a globally defined constant for the numberof liters per gallon. PLEASE HELP!!!
A liter is 0.264179 gallons. Write a program that will read in thenumber of liters of gasoline consumed by the user's car and thenumber of miles traveled by the car, and will then output thenumber of miles per gallon the car delivered. Your program shouldallow the user to repeat this calculation as often as the userwishes. Define 3 functions: one to take input from the user (usingpass by reference formal parameters),another to compute the numberof miles per gallon, and finally another to display the output.Your program should use a globally defined constant for the numberof liters per gallon.
Explanation / Answer
please rate -thanks the loop is in there. it asks yes or no I made a minor change to the above program so that it doesn't askbefore the program runs. change while loop to do-while loop #include using namespace std; const double liter=0.264179; void input(double& lgas, double& miles) { cout > lgas; cout > miles; } void mpg (double& milgal, double lgas, double miles) { double ggas; ggas=lgas*liter; milgal=miles/ggas; } void print(double milgal) { coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.