检查C中的条件 [英] Check condition in C

查看:94
本文介绍了检查C中的条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在C中每隔一秒检查一个条件?



if(i> 1000)

{

printf();

}



这是条件..如何做?

How to check one condition for every one seconds in C?

if(i>1000)
{
printf("");
}

this is the condition.. How to do it?

推荐答案

检查 C ++睡眠毫秒 [ ^ ]取决于各种操作系统和/或编译器的答案。

对于Visual C ++,你想要的函数是 Sleep (包含在windows.h中)



PS:对于Ubuntu Linux,它应该是 sleep()(小写s),并且应该包含在unistd.h中。请参阅 http://ubuntuforums.org/showthread.php?t=296142 [ ^ ]
Check C++ sleep for milliseconds[^] for answers depending on various OSs and/or compilers.
For Visual C++ the function you want is Sleep (included in windows.h)

P.S.: for Ubuntu Linux it should be sleep() (lowercase s) and should be included in unistd.h. see http://ubuntuforums.org/showthread.php?t=296142[^]


使用
delay(1000);





延迟所需的秒数然后使用你的条件



to delay for desired seconds and then use your condition


这篇关于检查C中的条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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