例如输出是 a=20 我想将数字 "20" 更改为另一个数字并将结果写入第一个输出的相同位置,而不是换行(不需要最早的 "a" 只是最后一个结果很重要) 我尽量避免这样的事情:
输出:
a=20
a=21
a=70
.
.
.
最佳答案
你试过这个吗:
printf("\ra=%d",a);
// \r=carriage return, returns the cursor to the beginning of current line
关于c++ - 如何在命令窗口的一个地方写一个变量并在同一个地方更新它的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10847358/