// Author: Keith Shomper // Date: 3/12/04 // Purpose: To demonstrate screen control with the sleep() function and escape characters #include #include #include using namespace std; int main() { int n; // Prompt the user for a countdown number cout << "From what number would you like to count down? "; cin >> n; for (int i = n; i >= 0; --i) { cout << setw(2) << i << flush; sleep(1); cout << '\010' << '\010' << ".." << "\n" << flush; } cout << "Clear the screen " << endl; sleep(2); cout << '\014' << flush; return 0; }