just starting out with programming and need some help figuring this out
Miles Per gallon
A car holds 12 gallons of gasoline and can travel 350 miles before refueling.
Write a program that calculates the number of miles per gallon the gar gets.
Display the result on the screen.
Hint: use the following formula to calculate miles per gallon (MPG):
MPG = miles driven/Gallons of Gas used
// Assignment 3 Example
// 6/12/2016
// Program to calculate mpg
// Page 143, #1
#include <iostream>
using namespace std; int main()
{
double gallons = 12 miles = 350;
double MPG = miles/gallons;
cout << "A car that holds " << gallons << "gallons of
// Assignment 3 Example
// 6/12/2016
// Program to calculate mpg
// Page 143, #1
#include <iostream>
using namespace std; int main()
{
int galGas, milesFullTank, cal;
double average;
cout << "Please enter the number of gallons of gas your car can hold: ";
cin >> galGas;
cout <<milesFullTank the number of miles your car can be driven on a full tank: ";
cin >> milesFulllTank;
cal = milesFullTank / galGas;
cout << "\nThe number of miles per gallon your car gets: " << cal << "." << endl << endl;
#include <iostream>
int main()
{
constdouble gallons = 12.0 ; // A car holds 12 gallons of gasoline
constdouble miles = 350.0 ; // and can travel 350 miles before refuelling
constdouble mpg = miles / gallons ; // formula: MPG = miles driven/Gallons of Gas used
std::cout << "A car that holds " << gallons << " gallons of gasoline and\n"
<< "travels " << miles << " miles before refuelling\n"
<< "gets " << mpg << " miles per gallon.\n";
}