ビープ音を鳴らしたいかどうかを尋ねるコマンドラインプログラムを作成しようとしています。私はSystem.FormatException
以下のコードに乗り続けます。の直後に問題が発生しConsole.WriteLine("how many times should i beep?");
ます。console.read();//pause
この行の後に右を置くことで修正を見つけました。
私の質問は、私が間違っていることは何ですか? または、その行の後に一時停止する必要がありますか?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("how fast would you like the sounds to play?");
Console.WriteLine("70 = fast and 300 = slow can pick any number inbetween");
string choice = Console.ReadLine();
int speed = Convert.ToInt32(choice);
Console.Write(speed);
Console.Read();//pause
Console.WriteLine("how many times should i beep?");
string choice2 = Console.ReadLine();
int j = Convert.ToInt32(choice2);
Console.Write(j);
Console.Read();//pause
for (int i = 0 ; i < j; i++)
{
Console.Beep(1000, speed);
}
}
}