While和For循环 [英] While and For loop
问题描述
对于for和while循环,这可能是非常快的事情.因此,有一种方法可以减慢它们的速度,并执行相同的操作,但是该操作发生的时间约为1秒?
For and while loop, are very fast thing that could happend. So is there a way to slow them down, and do the same thing but that thing happen like 1 sec???
例如,我想要打字机效果,有没有办法做到这一点?
For example I want a typewriter effect, is there a way to make this?
PS:我有点菜,但是我可以低估这种语言(c#和c ++)的工作风格.但是我的一些问题阻碍了我做这件事……(就像英语,当你不知道一个单词的时候)
PS: Im kinda noob, but I can understamd the working style of this language(c#, and c++). But some of my questions are blocking me to make that thing...(like english when you dont know a word)
推荐答案
您可以使用'System.Threading.Thread.Sleep(1000);'使您的处理等待1秒.一次.
You could use 'System.Threading.Thread.Sleep(1000);' to make your processing wait for 1 Sec. at a time.
例如:
for (int i = 0; i < 20; i++)
{
System.Threading.Thread.Sleep(1000);
Console.WriteLine(i);
}
希望
这篇关于While和For循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!