控制台输出覆盖当前行显示
visual studio下
#include <Windows.h> for (int i = 0; i < 10; ++i){ system("cls");//清屏 printf("num: %d\n", i); }
Linux下
for (int i = 0; i < 10; ++i){ printf("\033[1A\033[K"); printf("num: %d\n", i); }
visual studio下
#include <Windows.h> for (int i = 0; i < 10; ++i){ system("cls");//清屏 printf("num: %d\n", i); }
Linux下
for (int i = 0; i < 10; ++i){ printf("\033[1A\033[K"); printf("num: %d\n", i); }