How to control the terminal's cursor
Ever wanted to move the cursor up while printing output in a program? You can. Here’s how with C++, and the same string works with any language in many terminals: cout << "\x1b[A"; That moves the cursor up one line. You can move it up by as many lines as you want; here’s how to move it up by 3 lines: cout << "\x1b[3A"; A variable works there too: int lines = 3; cout << "\x1b[" << lines << "A"; You can also move the cursor down, right, and left....