我正在尽我最大的努力做这个程序,即制作一个程序,让用户可以随意掷两个骰子,但是掷出的骰子不能显示为数字,而是显示为图像。
如
[o]
掷骰子为 1。
我还没有为程序制作循环代码,我只知道如何为滚动制作随机数,我只是不知道如何为图像制作数组列表并使代码实际使用图像而不是数字...如果你知道我的意思。
到目前为止,这是我的代码,感谢您的帮助!
int[] DiceUno = new int[6];
int[] DiceDos = new int[6];
Random rnd = new Random();
Console.WriteLine("This program will allow you to roll two dice");
Console.WriteLine("\nAs many times as you want");
Console.WriteLine("\n\nWhen you want to exit the program, please type (exit)");
Console.WriteLine("\nPress any key to begin rolling");
Console.Read();
for (int i = 0; i < 1; i++)
{
int diceRoll = 0;
diceRoll = rnd.Next(6);
DiceUno[diceRoll]++;
Console.WriteLine("Dice 1 is rolled a: {0}", diceRoll + 1);
diceRoll = rnd.Next(6);
DiceDos[diceRoll]++;
Console.WriteLine("Dice 2 is rolled a: {0}", diceRoll + 1);
}
}
}
}