c#-4.0 - 如何检测从数组中的数字输入的数字
问题描述
我让它生成一个 4 位随机数并将其保存到不同的数组中,然后尝试让用户尝试猜测数字
生成一个随机的四位数字。玩家必须不断输入四位数字,直到他们猜出随机生成的数字。在每次不成功的尝试后,它应该说明他们正确了多少个数字,而不是他们正确的位置。在游戏结束时应该向用户表示祝贺并说出它尝试了多少次。这是我试图遵循的 breif
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
namespace _4_Number_Guess_Game
{
class Program
{
static void Main(string[] args)
{
int[] RanNums = new int[4];
for (int i = 0; i < 4; i++)
{
Random ran = new Random();
RanNums[i] = ran.Next(1, 9);
Thread.Sleep(11);
}
int[] Input = new int[4];
bool guess = false;
while (guess == false)
{
Console.WriteLine("Input a 4 digit number: ");
Console.
Console.ReadLine();
}
Console.ReadLine();
}
}
}