Answer to Question #260768 in C++ for binno

Question #260768

1.     Write a program that prompts the capacity, in gallons, of an automobile fuel tank and the miles per gallon the automobile can be driven. The program outputs the number of miles the automobile can be driven without refueling.


1
Expert's answer
2021-11-04T16:28:14-0400


SOLUTION TO THE ABOVE QUESTION


SOLUTION CODE


#include <iostream>
using namespace std;

int main(int argc, char** argv) {
	
	cout<<"\nEnter the capacity of an automobile fuel tank  in gallons : ";
	double _automobile_fuel_tank_capacity;
	cin>>_automobile_fuel_tank_capacity;
	cout<<"\nEnter the miles per gallon the automobile can be driven: ";
	double automobile_miles_per_gallon;
	cin>>automobile_miles_per_gallon;
	//Now lets calculate miles that can be driven
	double number_of_miles = _automobile_fuel_tank_capacity*automobile_miles_per_gallon;
	//Now print the number of miles
	cout<<"\nThe number of miles the automobile can be driven without refueling = "<<number_of_miles<<" miles"<<endl;
	return 0;
}



SAMPLE PROGRAM OUTPUT



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS