有个c语言图形函数难题需要解决
#include "graphics.h"main()
{ int max_x,max_y;
float ax=0;
float ay=0;
max_x=getmaxx()/2;
max_y=getmaxy()/2;
ax=ax+max_x;ay=ay+max_y;
int gd, gm;
gm=DETECT;
initgraph(&gm, &gd, "");
setbkcolor(1);
setcolor(14);
clearviewport ( );
setlinestyle(0,0,3);
putpixel(0,0,14);
getpixel(0,0);
lineto(0,0);
getpixel(0,0);
lineto(0,12.5);
moveto(8.5,0);
lineto(24.5,0);
moveto(8.5,0);
lineto(8.5,12.5);
moveto(24.5,0);
lineto(24.5,12.5);
moveto(24.5,0);
lineto(33,0);
moveto(33,0);
lineto(33,12.5);
moveto(33,12.5);
lineto(26.5,12.5);
moveto(26.5,12.5);
lineto(26.5,31.5);
moveto(26.5,12.5);
lineto(6.5,12.5);
moveto(6.5,12.5);
lineto(6.5,31.5);
moveto(6.5,12.5);
lineto(0,12.5);
moveto(26.5,31.5);
lineto(24.5,31.5);
moveto(26.5,31.5);
lineto(26.5,77.5);
moveto(24.5,31.5);
lineto(8.5,31.5);
moveto(8.5,31.5);
lineto(6.5,31.5);
moveto(6.5,31.5);
lineto(6.5,77.5);
moveto(6.5,77.5);
lineto(26.5,77.5);
moveto(0,0);
lineto(8.5,0);
setlinestyle(0,0,1);
moveto(24.5,31.5);
lineto(24.5,77.5);
moveto(8.5,31.5);
lineto(8.5,77.5);
getch();
closegraph();
}
printf("max_x:%d, max_y:%d",getmaxx(),getmaxy());
我需要把这个图形置于窗口的中心位置 哪位高手帮帮忙 非常感谢
2、 图形状态控制函数
1) detectgraph(); 图形适配器硬件测试。
格式:coid far detectgraph(int far *deriver,int far mode);
2) getmaxx():返回当前图形模式下屏幕的最大x值。
用法:max_x=getmaxx();
3) getmaxy():返回当前图形模式下屏幕的最大y值。
用法:max_y=getmaxy();
例:
………
printf(“x坐标最大值:%d,y坐标最大值:%d”,getmaxx( ),getmaxy( ));
………