I have to create a program calculating a car's gas mileage. The program should ask the user to enter the number of gallons of gas the car can hold, and the number of miles it can be driven on a full tank. It should then display the number of miles that may be driven per gallon of gas.
This is what I have so far. It seems okay but I could be completely wrong, this is my fist ever in a class creating programs so I am completely new to this.
#include <iostream>
using namespace std;
int main()
{
double capacity, miles, average
cout << "enter he number of gallons a tank can hold ";
cin >> capacity;
cout << "enter the number of miles driven on a full tank ";
cin >> miles;
average = miles/capacity
// calculate the dividend of the two numbers
// display the MPG
cout << the car’s mpg is: " << average << endl;
system("PAUSE");
return 0;
> Should I have put "// display the mpg" after cout << "the car's mpg is: "?
You can put this comment everywhere, but do not let its green color cover this line cout << "the car's mpg is: ";