Question: C++ A liter is 0.264179 gallons. Write a program that will read in the number of liters of gasoline consumed by the user's car and
A liter is 0.264179 gallons. Write a program that will read in the number of liters of gasoline consumed by the user's car and the number of miles traveled by the car and will then output the fuel efficiency given by the number of miles per gallon driven. Specifications: Define a function to compute the number of miles per gallon. Use the following function prototype: double fuelEfficiency (double liters, double miles); Use a globally defined constant for the number of gallons per liter called GPL. The fuel efficiency should print the result with one digit after the decimal point. As an example, if you execute the program with the following underlined inputs, the output will be: > main.o Enter the liters of gas consumed by the car: 15.2 Enter the miles driven by the car: 137.8 The fuel efficiency is 34.3 mpg
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
