求高人帮忙用C# 或者Vb 写个简单程序 急!
--------------------编程问答-------------------- 同时??只能根据CPU 的时间片来执行吧,也就是不可能在同一时间吧 --------------------编程问答-------------------- Thread t1 = new Tread(new delegate { while ( true ) { Console.Write("a"); } });
Thread t2 = new Tread(new delegate { while ( true ) { Console.Write("b"); } });
t1.Run();
t2.Run(); --------------------编程问答-------------------- 根据运行结果 讨论一下两个线程的行为 再帮帮忙!!
--------------------编程问答--------------------
--------------------编程问答-------------------- 拿10分走人 --------------------编程问答-------------------- 运行结果就是按照你所设定的结果走呗,先走第一个线程输出a,然后第二个线程输出B,他们不是同时输出,但是CPU处理速度快你是看不出来的 --------------------编程问答-------------------- 楼上的 程序要加什么? 错误是这样的 The type or namespace name 'Thread' could not be found (are you missing a using directive or an assembly reference?
static void Main(string[] args)
{
Thread t1 = new Thread(
new ThreadStart(
delegate
{
while (true)
{
Console.Write("a");
}
}));
Thread t2 = new Thread(
new ThreadStart(
delegate
{
while (true)
{
Console.Write("b");
}
}));
t1.Start();
t2.Start();
}
--------------------编程问答-------------------- using System.Thread? --------------------编程问答-------------------- using System.Threading .... --------------------编程问答-------------------- 学习了 --------------------编程问答-------------------- 楼主真是高人
补充:.NET技术 , C#