错误是在for循环中引起的:
for (i = 0; i < hand.Length; i++)
{
Console.WriteLine(hand[i]);
}
Run Code Online (Sandbox Code Playgroud)
我试图存储值,以便以后显示它们.写作线可以帮助我确保代码实际上按照我的意图运行.
其余代码供参考:*编辑:添加了一行代码
enum house //variable type for the card type
{
Spades, Hearts, Clubs, Diamonds
}
enum cards //variable type for the cards
{
Joker, Ace, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King
}
class Program
{
static void Main(string[] args)
{
Random rnd;
Random rnd2;
int i;
int random;
int random2;
String[] hand;
house randomhouse;
cards randomcard;
//all declared variables
Console.WriteLine("Your hand …Run Code Online (Sandbox Code Playgroud)