C++ Primer学习笔记第5章

// delay.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include 
#include  //describes clock() function, clock_t type
using namespace std;

int main()
{
    std::cout << "Enter the delay time inseconds:";
    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++ Primer学习笔记第5章)