#include \#include \#include \#include \#define PI 3.1415926 int a=200,b=200;
void initgraphics() {
int GraphDriver; int GraphMode; int ErrorCode; GraphDriver=DETECT;
initgraph(& GraphDriver,&GraphMode,\ ErrorCode=graphresult(); if(ErrorCode!=grOk)
{printf(\ grapherrormsg(ErrorCode); exit(0); } }
Line(int x0,int y0,float angle,float L,int color) {
float k,x1,y1; int jiao=(int)angle; int flag;
k=tan(angle/180*PI); x1=x0+L*cos(angle/180*PI); y1=y0+L*sin(angle/180*PI);
if((jiao60>=0)&&(jiao60<=45)||(jiao60>315)&&(jiao60<=360)) flag=1; else
if((jiao60>45)&&(jiao60<=90)||(jiao60>90)&&(jiao60<=135)) flag=2; else
if((jiao60>135)&&(jiao60<=180)||(jiao60>180)&&(jiao60<=225)) flag=3; else
if((jiao60>225)&&(jiao60<=270)||(jiao60>270)&&(jiao60<=3
15)) flag=4; switch(flag) {case 1: {int x; float y=y0; for(x=x0;x<=x1;x++) {
putpixel(x,(int)(y+0.5),color); a=x,b=(int)(y+0.5); y+=k; }
printf(\} break; case 2: {int y; float x=x0; for(y=y0;y<=y1;y++) {
putpixel((int)(x+0.5),y,color); a=(int)(x+0.5),b=y; x+=1/k;
}
printf(\} break; case 3: {int x; float y=y0; for(x=x0;x>=x1;x--) {
putpixel(x,(int)(y+0.5),color); a=x,b=(int)(y+0.5); y-=k; }
printf(\} break; case 4: {int y; float x=x0; for(y=y0;y>=y1;y--) {
putpixel((int)(x+0.5),y,color);