-
moveto()
鎖定
moveto()是一個函數,功能是將CP移到(x, y)。
- 中文名
- moveto()
- 功 能
- 將CP移到(x, y)
- 頭文件
- #include
- 屬 性
- 函數
moveto()簡介
函數名: moveto
功 能: 將CP移到(x, y)
用 法: void far moveto(int x, int y);
moveto()程序例
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
char msg[80];
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "");
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
}
/* move the C.P. to location (20, 30) */
moveto(20, 30);
/* plot a pixel at the C.P. */
putpixel(getx(), gety(), getmaxcolor());
/* create and output a message at (20, 30) */
sprintf(msg, " (%d, %d)", getx(), gety());
outtextxy(20, 30, msg);
/* move to (100, 100) */
moveto(100, 100);
/* plot a pixel at the C.P. */
putpixel(getx(), gety(), getmaxcolor());
/* create and output a message at C.P. */
sprintf(msg, " (%d, %d)", getx(), gety());
outtext(msg);
/* clean up */
getch();
closegraph();
return 0;
}
- 詞條統計
-
- 瀏覽次數:次
- 編輯次數:7次歷史版本
- 最近更新: 疯狂大炮_0101