How to go up a line in Console Programs (C++)

前端 未结 3 1253
我寻月下人不归
我寻月下人不归 2020-12-17 03:24

In C++ I\'m trying to go back up a line to add some characters. Here is my code so far:

cout << \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\xc9\\xbb\\n\\xc8\\xbc         


        
3条回答
  •  春和景丽
    2020-12-17 04:02

    If your console supports VT100 escape sequences (most do), then you can use ESC [ A, like this:

    cout << "\x1b[A";
    

    to move the cursor up one line. Repeat as necessary.

提交回复
热议问题