C ++改变输出从“cout” [英] C++ Change Output From "cout"
本文介绍了C ++改变输出从“cout”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以更改用cout打印的文本?我想让它显示当前百分比的东西,而不必为每个百分比的新行。这可能吗?
Is it possible to change text printed with "cout"? I would like to make it show the current percentage of something without having to have a new line for each percentage. Is this possible?
推荐答案
这适用于我:
std::cout << "1111";
std::cout << "\r";
std::cout << "2222";
\r
是回车符。
也可以使用 \b
字符。这是退格。当打印时,它返回一个字符。
Alternatively you can use \b
character. This is backspace. When printed it goes one character back.
这篇关于C ++改变输出从“cout”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文