これは、通勤費を計算するための私の最初のプログラムです。Visual Studio でデバッグの問題が発生しているため、ヘルプを探しています...
#include <iostream>
using namespace std;
int main()
{
int miles, gallons, gallonCost, mpg, mileCost, parking, tolls, FuelCost, TotalCost = 0.0;
上記の行が何をしているのか (またはしていないのか) を誰かが説明できますか? float 整数のリストを作成する正しい方法ですか?
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;
}
前もって感謝します