#include #include #include #include void main() { struct point { int x,y; } p1, p2; int lon,sho,Drive, Mode; float i, t, x, y; printf("give me the 1st point --> "); scanf("%d %d",&p1.x,&p1.y); printf("give me the 2st point --> "); scanf("%d %d",&p2.x,&p2.y); Drive=DETECT; initgraph(&Drive, &Mode, ""); setcolor(14); line(p1.x,p1.y,p2.x,p2.y); getche(); clearviewport(); for (t=0; t<=1; t+=0.005) { x=(1-t)*p1.x+t*p2.x; y=(1-t)*p1.y+t*p2.y; if ((x >= 0) && (x <= 639) && (y >= 0) && (y <= 479)) putpixel(x,y,6); } getche(); closegraph(); }