- 博客(0)
- 资源 (5)
- 收藏
- 关注
梦幻抽奖VS金山打字程序
int j = 0;
while (true)
{
ConsoleKeyInfo c;
string str = "1,2,3,4,5,6,7,8,9,0,";
str += "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,";
str += "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
string[] s = str.Split(new char[] { ','});
string strnum = "";
Random r = new Random();
int number = r.Next(62);
strnum = s[number];
Console.Write(strnum);
int Row, Col;
Row = Console.CursorTop;
Col = Console.CursorLeft;
Console.SetCursorPosition(Col-1, Row + 1);
int width = Console.WindowWidth;
j++;
l1: c = Console.ReadKey();
if (c.Key != ConsoleKey.Escape)
{
if (c.KeyChar.ToString().Trim() == strnum)
{
Console.SetCursorPosition(Col-1, Row + 1);
Console.ForegroundColor = ConsoleColor.Red;
Console.Write(strnum);
Console.ResetColor();
if (j == 27)
{
j = 0;
Console.WriteLine("\n");
}
else
Console.SetCursorPosition(Col + 2, Row);
}
else
{
Console.SetCursorPosition(Col - 1, Row + 1);
goto l1;
}
}
else
break;
}。
2009-02-23
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人