課題の 1 つで 2 つの異なる入力値を C# に入力するのに問題があります。私がセットアップした方法でデバッグしたくないようです。
- 出力値は次のとおりです。マイル/ガロン
- 入力値は次のとおりです: 走行マイル、使用ガスのガロン
これは私がこれまでにセットアップした方法ですが、まだ機能しません。
static void Main(string[] args)
{
float milespergallon, milestraveled, gallonsofgasused;
string textLine;
Console.Write("What is the total miles traveled and gallons of gas used? ");
textLine = Console.ReadLine(); // read in text from console
milestraveled and gallonsofgasused = float.Parse(textLine); // convert text into floating point
milespergallon = miles / gallons; // calculate mpg = miles / gallons
Console.Write("Miles Per Gallon: ");
Console.WriteLine(milespergallon.ToString());// Output miles per gallon to console
Console.ReadLine(); // Wait for return key press
}