std::cout to print character N times

前端 未结 3 1291
星月不相逢
星月不相逢 2020-12-29 03:32

How can I print a character N number of times using std::cout without looping?

Is there a way to move the text cursor back to nullify the effect of

3条回答
  •  爱一瞬间的悲伤
    2020-12-29 03:58

     std::cout << std::string(100, '*') << std::endl;
    

    To move a line up, you have to resort to terminal escapes (assuming that isatty() indicates that you are running on one).

提交回复
热议问题