0

头文件的延迟功能dos.h在代码块中不起作用。它表明延迟函数未声明。以下链接包含以下程序。 关联

int main  ()
{ 
printf     (  "  This c program will exit in 10 seconds.\n");         
delay(10000);                         
return 0;
}
4

2 回答 2

0

我也有同样的问题&我使用了这个功能

 #include <time.h>
 void delay(int milliseconds)
 {
   long pause;
   clock_t now,then;

   pause = milliseconds*(CLOCKS_PER_SEC/1000);
   now = then = clock();
   while( (now-then) < pause )
     now = clock();
 }

编辑:

正如所评论的,这确实使系统忙碌。我有更好的方式来做这件事,并且为 CodeBlocks 工作。

#include <windows.h>
 .
 .
 .
 Sleep(100); //sleep for 0.1 second
 .
于 2015-01-25T04:43:10.923 回答
0

我认为它只适用于turbo c。它是 Borland 特有的,在 turbo c 编译器中工作。

见链接

于 2017-01-31T12:49:02.007 回答