#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;
}

相关文章:

  • 2021-12-27
  • 2022-01-06
  • 2021-07-07
  • 2022-01-06
  • 2021-09-07
  • 2022-01-11
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
  • 2021-05-25
  • 2022-12-23
  • 2021-08-05
  • 2022-12-23
相关资源
相似解决方案