#include<iostream>
#include<ctime> //typedef long clock_t
int main()
{
using namespace std;
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;
}
不能理解这个clock()函数究竟该如何去使用它,暂且记住这个模板便于以后使用。