// Example 14.11. Program to test delaySec #include #include using namespace std; int main() { void delaySec(int seconds); int numSeconds; /* number of seconds */ for (numSeconds = 0; numSeconds < 4; numSeconds++) { cout << "A delay of " << numSeconds << " follows\n"; delaySec(numSeconds); } cout << "Test ends\n"; return 0; } // // Delay seconds number of seconds // Pre: seconds is a positive integer. // Post: Execution was delayed seconds number of seconds. // void delaySec(int seconds) { time_t curTime = time(static_cast(NULL)); while(time(static_cast(NULL)) < curTime + static_cast(seconds)); }