//  YOUSEF RABAH      Oct. 9th, 2001                            DRAWER 1602
#include "CS35lib.h"

double miles_p_gallon (int miles, double gallons)
{
	return (miles/gallons); 
}
//Function will divide miles over the gallons to get miles per gallon. 	


int main ()
{
	int miles_A, miles_B;
	double gallons_A, gallons_B, mpg_A, mpg_B;
	int miles, gallons;
	 
	
	cout << "How many miles did car A go (an integer)? ";
	cin  >> miles_A;
	cout << "How many gallons were used? ";
	cin  >> gallons_A;
	cout<<endl;
	cout << "How many miles did car B go (an integer)? ";
	cin  >> miles_B;
	cout << "How many gallons were used? ";
	cin  >> gallons_B;
	
	mpg_A = miles_p_gallon (miles_A, gallons_A);
	mpg_B = miles_p_gallon (miles_B, gallons_B);
	//use the mpg function twice here; once for car A and once for car B
	// Another detail: control alignment and decimal point
	set_decimal (1);
	cout<<endl;
	cout << "Car A got "<<mpg_A<<" miles per gallon.\n";
	cout << "Car B got "<<mpg_B<<" miles per gallon.\n";
	return 0;
}

/*
OUTPUT:
How many miles did car A go (an integer)? 200
How many gallons were used? 8.1

How many miles did car B go (an integer)? 280
How many gallons were used? 10.3

Car A got 24.7 miles per gallon.
Car B got 27.2 miles per gallon.
*/
	
	

