delay_5.c

来自「《C/C++程序员实用大全》配套代码,适用初学C++的人员。」· C语言 代码 · 共 24 行

C
24
字号
#include <stdio.h>
#include <time.h>

void main(void)
 {
    time_t current_time;
    time_t start_time;

    printf("About to delay 5 seconds\n");

    time(&start_time);  // Get starting time in seconds

    do 
    {
      time(&current_time);
    } 
    while ((current_time - start_time) < 5);

    printf("Done\n");
 }



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?