#include <iostream>
usingnamespace std;
int main(){
double tankSize, city, highway;
int cost;
int percent;
cout << "Enter the size of the gas tank of the car in gallons: ";
cin >> tankSize;
cout <<"Enter the MPG you get in the city: ";
cin >> city;
cout <<"Enter the MPG you get in the highway: ";
cin >> highway;
cout << "What percentage do you travel on the highway? ";
cin >> percent;
return 0;
}
i need to determine the amount of miles that can be traveled for a single tank of gas.
I'll use a double for percent instead of an int.
Assuming percent is entered as a value between 0 and 100 then: actualMPG = highway*percent/100.0 + city*(1 - percent/100.0);