求一个用C#编写的36选7代码

来源:百度知道 编辑:UC知道 时间:2024/06/30 08:44:09
要求:运行时在控制台中 有七个数字在闪动... 按某个键或者空格或者回车停止闪动 并出现7个数字...我只能做到闪动,剩下的请高手帮个补充下..谢谢..
闪动代码如下:
using System;
namespace MyName
{
class Myname
{
static void Main()
{
bool b = true;
Random r1 = new Random();
char c;

while (b)
{
Console.Clear();
for (int i = 0; i < 7; i++)
{
Console.Write(r1.Next(36)+"\t");
}
}

Console.ReadLine();
}
}
}

这个有点怪,我看看

下面的代码,按回车就停止
static bool b = true;
static void Main()
{

Random r1 = new Random();
System.Threading.Thread th = new System.Threading.Thread(new System.Threading.ThreadStart(F));
th.Start();
while (b)
{
Console.Clear();
for (int i = 0; i < 7; i++)
{
Console.Write(r1.Next(37) + "\t");//改为37
}
}

Console.ReadLine();
}

public static void F()
{
if(Console.ReadLine()=="")
b = false;
}

这样来

要用threading 才行啊. 已经调试好了.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace ConsoleApplication4
{
class Program
{
static string input = null;
static void Main(string[] args)
{
Random r1 = new Random();