#include #include #include //for class chrono #include //for class this_thread using namespace std; /* Each line of output consists of line puffs of smoke followed by rocket. Thanks to the carriage return (\r), all the lines are printed in the same place. */ int main() { const int framesPerSecond {20}; const int milliseconds {1000 / framesPerSecond}; cout << "\n"; //Go down to the start of a new line. const int numberOfLines {78}; for (int line {0}; line < numberOfLines; ++line) { for (int puff {0}; puff < line; ++puff) { cout << "."; //a puff of smoke } cout << "==>\r" << flush; //the rocket //Sleep for one tenth of a second. this_thread::sleep_for(chrono::milliseconds(100)); } cout << "\n"; //Go down to the start of a new line. return EXIT_SUCCESS; }