#include <graphics.h> #include <conio.h> main() { int gdriver,gmode; int arrow[16]={200,102,300,102,300,107,330,100,300,93,300,98,200,98,200,102}; int i;
struct line { int s; unsigned u; int t; }; struct line *p;
gdriver=DETECT; window(10,10,42,12); textattr(128+8+2); clrscr(); cprintf("\n\r ready to go into graphic mode?"); getch();
initgraph(&gdriver,&gmode,""); setbkcolor(MAGENTA); setcolor(14); setlinestyle(DOTTED_LINE,0,THICK_WIDTH);
putpixel(120,200,GREEN); arc(120,200,91,40,100); getch(); setbkcolor(BLUE); setcolor(CYAN); ellipse(140,300,10,300,40,220); getch(); rectangle(250,200,430,300); getch(); /*cleardevice();*/ drawpoly(8,arrow); getch(); putpixel(200,102,RED); putpixel(300,102,RED); putpixel(300,107,RED); putpixel(330,100,RED);
getlinesettings(p); getch();
/*closegraph();*/ printf("\n\r linestyle=%d upattern=%u linethickness=%d\n\r",p->s,p->u,p->t); getch(); printf("\n\r the x y values of numpoints in the dotted arrow\n\r"); printf(" x y\n\r"); for(i=0;i<16;i++)
{ if(i%2==0) printf(" %-3d ",arrow[i]); else {printf("%-3d\n\r",arrow[i]); getch();}
} printf("\n\r ready back to text mode?"); getch(); closegraph();
window(35,15,60,17); textattr(128+11+5); clrscr(); cprintf("\n\r bye-bye! good luck!"); getch(); }
[此贴子已经被作者于2005-1-6 20:49:12编辑过]