class Program
{
static void Main(string[] args)
{
int f = 0;
Console.WriteLine("enter ammount of tries");
int trycount = Convert.ToInt32(Console.ReadLine());
Random numgen = new Random();
while (f < trycount)
{
int now = numgen.Next(1, 6);
int avg = 0 + now;
f++;
}
Console.WriteLine(avg);
Console.ReadLine();
}
}
問題是存在的,這個名字:錯誤當我嘗試運行它說,這個項目的名稱不會在目前情況下
「平均」不在當前情況下存在
爲什麼會發生這種情況,我該如何解決這個問題。
定義平均超出了你的循環範圍。 – mybirthname