coord

更新时间:2025-05-18 08:55:52 阅读: 评论:0

coord

COORD是Windows API中定义的一种结构,表示一个字元在控制台萤幕上的坐标。其定义为:

typedef struct _COORD {

SHORT X; // horizontal coordinate

SHORT Y; // vertical coordinate

} COORD;

基本介绍

外文名:coord 出处:Windows API 表示:一个字元在控制台萤幕上的坐标 所属学科:软体

定义

typedef struct _COORD {SHORT X; // horizontal coordinate
SHORT Y; // vertical coordinate
} COORD;

性质

表示一个字元在控制台萤幕上的坐标。套用c++中的例子:#include <iostream>#include <Windows.h>using namespace std;void gotoxy(int x,int y){COORD loc={x,y};HANDLE hOutput=GetStdHandle(STD_OUTPUT_HANDLE);SetConsoleCursorPosition(hOutput,loc);}int main(){gotoxy(2,0);cout<<"Hello World!"<<endl;system("pause");return 0;}=============输出结果为(下划线表示此处无字元,)==============__Hello World!请按任意键继续…==========================================================C中的例子:void Pos(int x, int y){COORD pos;HANDLE hOutput;pos.X = x;pos.Y = y;hOutput = GetStdHandle(STD_OUTPUT_HANDLE);SetConsoleCursorPosition(hOutput, pos);}

本文发布于:2023-03-25 21:06:35,感谢您对本站的认可!

本文链接:http://www.ranqi119.com/to/1679922190237451.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:coord
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 站长QQ:55-9-10-26|友情:优美诗词|电脑我帮您|扬州装修|369文学|学编程|软件玩家|水木编程|编程频道