Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A liter is 0.264179 gallons. Write a program that will read in the number of lit

ID: 3761758 • Letter: A

Question

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 number of miles per gallon the car delivered. Your program should allow the user to repeat this calculation as often as the user wishes. Define a function to compute the number of miles per gallon. Your program should use a globally defined constant for the number of liters per gallon.

The simplest way to write this in c++ programming

Explanation / Answer

#include<iostream>

#include<limits.h>

using namespace std;

double milesPerGallon(double petrol,double miles ){

double gallons = 0.264179*petrol;

return miles/gallons;

}

int main(){

  

cout<<milesPerGallon(5,10)<<endl;

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote