#include #include #include //for the function chrono::milliseconds #include //for the function this_thread::sleep_for using namespace std; int main() { char a[70]; const size_t n {size(a)}; //the number of elements in the array //Fill up the array with spaces. for (int i {0}; i < n; ++i) { a[i] = ' '; } cout << "\033[2J"; //Clear the screen. cout << "\033[H"; //Home the cursor. //During each iteration of this loop, the ++i makes us //redraw the rocket one character farther to the right. for (int i {0}; i < n-3; ++i) { a[i + 0] = '.'; //trailing puff of smoke a[i + 1] = '='; a[i + 2] = '='; a[i + 3] = '>'; //the nose cone //Output the array onto the screen. for (int j{0}; j < n; ++j) { cout << a[j]; } //Flush the output buffer for smoother animation. cout << "\r" << flush; //Sleep for 250 milliseconds (a quarter of a second). this_thread::sleep_for(chrono::milliseconds(250)); } cout << "\n"; //Go down one line. cout << "BOOM!\n"; return EXIT_SUCCESS; }