//所需头: #include<windows.h> // 设置光标位置 void Gotoxy(int x, int y) { COORD coord; coord.X = x; coord.Y = y; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord); // 移动光标 } int main() { Gotoxy(x,y);//x为横坐标,即为所在行数;y为纵坐标,即为所在列数 return 0; }