/*
// Author:Zachary //
// //
// Date: 09/06/14 1:34 //
// Program Description:Write a program that asks the user for //
* how many miles they drove and how much gas they used //
// //
// Input: distance, gallons //
// Processing: MPG = MilesDriven / GallonsUsed //
// Output: MPG //
*/
#include <iostream>
using namespace std;
/*
*
*/
int main()
{
int gallons = 0;
double distance = 0.0;
double mpg = 0.0;
do
{
cout << "Please input how many gallons of gasoline are in your vehicle: ";
cin >> gallons;
cout << "Please input the distance in miles you traveled in your vehicle: ";
cin >> distance;
mpg = distance / gallons;
cout << "Your vehicle's MPG is: " << mpg << endl;
}while(gallons >-1);
return 0;
}
// Author:Zachary //
// //
// Date: 09/06/14 1:34 //
// Program Description:Write a program that asks the user for //
* how many miles they drove and how much gas they used //
// //
// Input: distance, gallons //
// Processing: MPG = MilesDriven / GallonsUsed //
// Output: MPG //
*/
#include <iostream>
using namespace std;
/*
*
*/
int main()
{
int gallons = 0;
double distance = 0.0;
double mpg = 0.0;
do
{
cout << "Please input how many gallons of gasoline are in your vehicle: ";
cin >> gallons;
cout << "Please input the distance in miles you traveled in your vehicle: ";
cin >> distance;
mpg = distance / gallons;
cout << "Your vehicle's MPG is: " << mpg << endl;
}while(gallons >-1);
return 0;
}
No comments:
Post a Comment