While和For循环 [英] While and For loop

查看:103
本文介绍了While和For循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆