void eds(int x1,int y1,int x2,int y2){
int x3,y3;
switch(pozition(x1,y1,x2,y2)){
case 1:
if(x2>x1){
y2=y1;
x3=x1+(x2-x1)/2;
line(x1,y1,x3-2,y1);
line(x3+1,y2,x2,y2);
line(x3-2,y1-3,x3-2,y1+3);
line(x3+1,y2-7,x3+1,y2+7);
}
if(x2<x1){
x3=x2+(x1-x2)/2;
y2=y1;
line(x2,y2,x3-2,y1);
line(x3+1,y2,x1,y1);
line(x3-2,y1-7,x3-2,y1+7);
line(x3+1,y2-3,x3+1,y2+3);
}
break;
case 2:
if(y1<y2){
y3=y1+(y2-y1)/2;
x2=x1;
line(x1,y1,x1,y3-2);
line(x2,y3+1,x2,y2);
line(x1-3,y3-2,x1+3,y3-2);
line(x1-7,y3+1,x1+7,y3+1);
}
if(y1>y2){
y3=y2+(y1-y2)/2;
x2=x1;
line(x1,y1,x1,y3+2);
line(x2,y3-1,x2,y2);
line(x1+3,y3+2,x1-3,y3+2);
line(x1+7,y3-1,x1-7,y3-1);
}
break;
case 3:
if(x2>x1){
y2=y1-(x2-x1);
x3=x1+(x2-x1)/2;
y3=y1+(y2-y1)/2;
line(x1,y1,x3-1,y3+1);
line(x3+1,y3-1,x2,y2);
line(x3-3,y3-1,x3+1,y3+3);
line(x3-4,y3-6,x3+6,y3+4);
}
if(x2<x1){
y2=y1+(x1-x2);
x3=x2+(x1-x2)/2;
y3=y1+(y2-y1)/2;
line(x1,y1,x3+1,y3-1);
line(x3-1,y3+1,x2,y2);
line(x3+3,y3+1,x3-1,y3-3);
line(x3+4,y3+6,x3-6,y3-4);
}
break;
case 4:
if(x2>x1){
y2=y1+(x2-x1);
x3=x1+(x2-x1)/2;
y3=y1+(y2-y1)/2;
line(x1,y1,x3-1,y3-1);
line(x3+1,y3+1,x2,y2);
line(x3-3,y3+1,x3+1,y3-3);
line(x3-4,y3+6,x3+6,y3-4);
}
if(x2<x1){
y2=y1-(x1-x2);
x3=x2+(x1-x2)/2;
y3=y2+(y1-y2)/2;
line(x1,y1,x3+1,y3+1);
line(x3-1,y3-1,x2,y2);
line(x3+3,y3-1,x3-1,y3+3);
line(x3+4,y3-6,x3-6,y3+4);
}
break;
}
}
// Функция, рисующая электрическую лампу
void lampochka(int x1,int y1,int x2,int y2){
int x3,y3;
switch(pozition(x1,y1,x2,y2)){
case 1:
if(x2>x1){
y2=y1;
x3=x1+(x2-x1)/2;
line(x1,y1,x3-7,y1);
line(x3+7,y2,x2,y2);
circle(x3,y1,7);
line(x3-3,y1-3,x3+3,y1+3);
line(x3+3,y1-3,x3-3,y1+3);
}
if(x2<x1){
x3=x2+(x1-x2)/2;
y2=y1;
line(x2,y2,x3-7,y2);
line(x3+7,y1,x1,y1);
circle(x3,y2,7);
line(x3-3,y2-3,x3+3,y2+3);
line(x3+3,y2-3,x3-3,y2+3);
}
break;
case 2:
if(y1<y2){
y3=y1+(y2-y1)/2;
x2=x1;
line(x1,y1,x1,y3-7);
line(x1,y3+7,x2,y2);
circle(x1,y3,7);
line(x1-3,y3-3,x1+3,y3+3);
line(x1+3,y3-3,x1-3,y3+3);
}
if(y1>y2){
y3=y2+(y1-y2)/2;
x2=x1;
line(x1,y1,x1,y3+7);
line(x2,y3-7,x2,y2);
circle(x1,y3,7);
line(x1-3,y3-3,x1+3,y3+3);
line(x1+3,y3-3,x1-3,y3+3);
}
break;
case 3:
if(x2>x1){
y2=y1-(x2-x1);
x3=x1+(x2-x1)/2;
y3=y1+(y2-y1)/2;
line(x1,y1,x3-5,y3+5);
line(x3+5,y3-5,x2,y2);
circle(x3,y3,7);
line(x3-3,y3-3,x3+3,y3+3);
line(x3+3,y3-3,x3-3,y3+3);
}
if(x2<x1){
y2=y1+(x1-x2);
x3=x2+(x1-x2)/2;
y3=y1+(y2-y1)/2;
line(x1,y1,x3+5,y3-5);
line(x3-5,y3+5,x2,y2);
circle(x3,y3,7);
line(x3-3,y3-3,x3+3,y3+3);
line(x3+3,y3-3,x3-3,y3+3);
}
break;
case 4:
if(x2>x1){
y2=y1+(x2-x1);
x3=x1+(x2-x1)/2;
y3=y1+(y2-y1)/2;
line(x1,y1,x3-5,y3-5);
line(x3+5,y3+5,x2,y2);
circle(x3,y3,7);
line(x3-3,y3-3,x3+3,y3+3);
line(x3+3,y3-3,x3-3,y3+3);
}
if(x2<x1){
y2=y1-(x1-x2);
x3=x2+(x1-x2)/2;
y3=y2+(y1-y2)/2;
line(x1,y1,x3+5,y3+5);
line(x3-5,y3-5,x2,y2);
circle(x3,y3,7);
line(x3-3,y3-3,x3+3,y3+3);
line(x3+3,y3-3,x3-3,y3+3);
}
break;
}
}