c++ 延迟执行

//CLOCKS_PER_SEC 每秒钟包含的系统时间单位数

cout<<"Enter the delay time,in seconds: ";
        float secs;
        cin >>secs;
        clock_t delay=secs*CLOCKS_PER_SEC;
        cout<<"starting\a\n";
        clock_t start =clock();
        while(clock()-start<delay)
         ;
         cout<<"done \a\n";
        return 0;

你可能感兴趣的:(C++)