好用的清屏函数
#ifdef _WIN32
/* 包含Windows平台相关函数,包括控制台界面清屏及光标设定等功能 */
#include <conio.h>
#include <windows.h>
#include <io.h>
#include <direct.h>
#include <Shlobj.h>
#endif
//清屏
void clear_screen()
{
#ifdef _WIN32
/* 重设光标输出位置清屏可以减少闪烁,system("cls")为备用清屏命令,均为Windows平台相关*/
COORD pos = { 0, 0 };
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
CONSOLE_CURSOR_INFO info = { 1, 0 };
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info);
#endif
}