using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static Random newletter = new Random();
static void Main(string[] args)
{
string[] alphabet;
Console.WriteLine("Typing reflex game"); Console.WriteLine(); Console.WriteLine();
Console.WriteLine("You must type the letter you see as fast as you can");
Console.WriteLine("Hit enter to start");
Console.ReadLine();
Console.WriteLine("The game starts in: 3"); System.Threading.Thread.Sleep(1000);
Console.WriteLine("The game starts in: 2"); System.Threading.Thread.Sleep(1000);
Console.WriteLine("The game starts in: 1"); System.Threading.Thread.Sleep(1000);
ConsoleKeyInfo inputletter;
alphabet = new string[26];
alphabet[0] = "A";
alphabet[1] = "B";
alphabet[2] = "C";
alphabet[3] = "D";
alphabet[4] = "E";
alphabet[5] = "F";
alphabet[6] = "G";
alphabet[7] = "H";
alphabet[8] = "I";
alphabet[9] = "J";
alphabet[10] = "K";
alphabet[11] = "L";
alphabet[12] = "M";
alphabet[13] = "N";
alphabet[14] = "O";
alphabet[15] = "P";
alphabet[16] = "Q";
alphabet[17] = "R";
alphabet[18] = "S";
alphabet[19] = "T";
alphabet[20] = "U";
alphabet[21] = "V";
alphabet[22] = "W";
alphabet[23] = "X";
alphabet[24] = "Y";
alphabet[25] = "Z";
do
{
Console.Clear();
int lol = newletter.Next(0, 25);
Console.WriteLine("Typing reflex game"); Console.WriteLine(); Console.WriteLine();
Console.WriteLine(" TYPE THIS LETTER:"); Console.WriteLine();
Console.Write(" "+ alphabet[lol]);
inputletter = Console.ReadKey();
inputletter = Convert.ToString;
alphabet[lol].ToString();
if (inputletter == alphabet[lol])
{
// Add a point, or something
}
Console.WriteLine(inputletter.Key.ToString());
} while (inputletter.Key != ConsoleKey.Escape);
}
}
}
这部分:
&
#160; {C}
我练对高校工作的,我试图做一个应用程序,在信中显示用户类型,那么它显示多少,他们怎么过许多尝试(我会尽量把定时器系统)得到了纠正。我不知道如何使检查它,如果inputletter(字母键输入时)等于字母表[LOL](一个随机选择的字母在字母表中的阵列)
请帮助{S0的}
和任何其他的帮助,将不胜感激
- 首次使用本网站
我得到了2个错误:
不能转换到非委托类型System.ConsoleKeyInfo的方法组的ToString。你打算调用的方法吗?
:
==操作符不能用于类型System.ConsoleKeyInfo和字符串的操作数