C 中的 Getarcoords 函数
2021-07-07 18:24:10
深夜i
--
--
C
的
e
t
a
r
c
o
o
r
d
s
数
声明: void getarccoords(struct arccoordstype *var);
getarccoords 函数用于获取最近绘制的弧的坐标。 arccoordstype 是一个预定义的结构,定义如下:
struct arccoordstype
{
int x, y; /* center point of arc */
int xstart, ystart; /* start position */
int xend, yend; /* end position */
};
arccoordstype 类型的结构变量的地址被传递给函数 getarccoords。
getarccords 的 C 程序
#include<graphics.h>
#include<conio.h>
#include<stdio.h>
main()
{
int gd = DETECT, gm;
struct arccoordstype a;
char arr[100];
initgraph(&gd, &gm,"C:\\TC\\BGI");
arc(250,200,0,90,100);
getarccoords(&a);
sprintf(arr,"(%d, %d)",a.xstart,a.ystart);
outtextxy(360,195,arr);
sprintf(arr,"(%d, %d)",a.xend,a.yend);
outtextxy(245,85,arr);
getch();
closegraph();
return 0;
}
在程序中,我们已经绘制了一个圆弧,然后我们使用 getarccoords 获取其端点的坐标。 使用 outtextxy 显示如此获得的坐标。
上一篇:
idea打包java可执行jar包
下一篇:
C 中的 getbkcolor 函数
评论区