我在这里有一个代码,可能会延迟10秒才能继续,但我想添加一个功能,用户可以等待延迟或按任意键继续,我知道它不会像delay(10000) || getch();
任何方式做到这一点?“按任意键或等待10秒钟继续”
#include <stdio.h>
#include <conio.h>
#include <dos.h>
void main(){
clrscr();
printf("Press Any Key or Wait for 10 Seconds to Continue");
delay(10000);
//getch();
}
你可以很好地与线程做到这一点。你对这个知道多少? – Bathsheba
你可以采取一个时间戳,做一个忙等待循环,当一个键被按下或一个新的时间戳显示10s已经通过 – Leeor
结束[如何停用输入语句一段时间?](http://stackoverflow.com/questions/18289635/how-to-deactivate-input-statement-after-some-time) – alk