这是我的第一个计算通勤成本的程序。Visual Studio 在调试时遇到问题,所以我正在寻求帮助...
#include <iostream>
using namespace std;
int main()
{
int miles, gallons, gallonCost, mpg, mileCost, parking, tolls, FuelCost, TotalCost = 0.0;
有人可以解释上面的行在做什么(或不做什么)是制作浮点整数列表的正确方法吗?
cout << " How many miles do you drive per day? ";
cin >> miles;
cout << " What is the price per gallon of fuel? ";
cin << gallonCost;
cout << " How many gallons of fuel do you use per day? ";
cin >> gallons;
mpg = miles / gallons;
mileCost = gallonCost / mpg;
cout << " Your fuel efficentcy is " << mpg ;" miles per gallon. ";
cout << " Your fuel cost is $" << mileCost ;" per mile. ";
FuelCost = mileCost * miles;
cout << " Your paying $" << FuelCost ;" for fuel per day.";
cout << " What are you daily parking fees? ";
cin << parking;
cout << " How much do you spend on Tolls each day? ";
cin >> tolls;
TotalCost = parking + tolls + FuelCost;
cout << " Your driving cost is $" << TotalCost ;" per day." endl;
system("PAUSE");
return 0;
}
提前致谢