#include <stdio.h>
#include <conio.h>
#include <windows.h>
void gotoxy(int x, int y)
{
COORD coord = {x, y};
/*COORD是Windows API中定义的一种结构,表示一个字符在控制台屏幕上的坐标。其定义为:
typedef struct _COORD {
SHORT X; // horizontal coordinate
SHORT Y; // vertical coordinate
} COORD;*/
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
int main(int argc,char *argv[])
{
gotoxy(5,5);
printf("hello!\n");
return 0;
}
【C语言】在VC中使用gotoxy函数实现光标的移动
最新推荐文章于 2022-07-16 21:45:02 发布