shiraz shiraz - 1 year ago 106
C++ Question

std::cout to print character N times

How can I print a character N number of times using

without looping?

Is there a way to move the text cursor back to nullify the effect of
std::cout << std::endl;
? i.e. to move up a line (say we never printed anything after doing the
std::cout << std::endl;

Answer Source
 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).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download