请输入您要查询的百科知识:

 

词条 getarccoords
释义

函数名: getarccoords

功 能: 取得最后一次调用arc的坐标

用 法: void far getarccoords(struct arccoordstype far *arccoords);

程序例:

#include

#include

#include

#include

int main(void)

{

/* request auto detection */

int gdriver = DETECT, gmode, errorcode;

struct arccoordstype arcinfo;

int midx, midy;

int stangle = 45, endangle = 270;

char sstr[80], estr[80];

/* initialize graphics and local variables */

initgraph(&gdriver, &gmode, "");

/* read result of initialization */

errorcode = graphresult();

/* an error occurred */

if (errorcode != grOk)

{

printf("Graphics error: %s\",

grapherrormsg(errorcode));

printf("Press any key to halt:");

getch();

/* terminate with an error code */

exit(1);

}

midx = getmaxx() / 2;

midy = getmaxy() / 2;

/* draw arc and get coordinates */

setcolor(getmaxcolor());

arc(midx, midy, stangle, endangle, 100);

getarccoords(&arcinfo);

/* convert arc information into strings */

sprintf(sstr, "*- (%d, %d)",

arcinfo.xstart, arcinfo.ystart);

sprintf(estr, "*- (%d, %d)",

arcinfo.xend, arcinfo.yend);

/* output the arc information */

outtextxy(arcinfo.xstart,

arcinfo.ystart, sstr);

outtextxy(arcinfo.xend,

arcinfo.yend, estr);

/* clean up */

getch();

closegraph();

return 0;

}

随便看

 

百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2024/12/23 11:22:43