This is just a simple distance per tank calculator given fuel economy for variables. Exactly what does this error mean in relation to my code? ----[error] 'double totalMPG' previously declared here------
//This program calculates the distance a car can travel on one tank of gas
#include <iostream>
usingnamespace std;
int main()
{
double cityMPG = 21.5, //Miles per gallon in city
highwayMPG = 26.8, //Miles per gallon on highway
totalMPG, //To hold total city and highway MPG combined
avgMPG, //To hold average of city and highway mileage
tankCapacity = 20, //Capacity of gas tank
distance, //To hold distance car can travel
//Calculate the total combined city and highway mpg
totalMPG = cityMPG + highwayMPG;
//Calculate average mileage
avgMPG = totalMPG / 2;
//Calculate distance car can travel
distance = avgMPG * tankCapacity;
//Display distance car can travel
cout << "The car can travel a distance of " << distance << " miles" << endl;
return 0;
}