1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
#include<stdio.h> #include<conio.h> #include<graphics.h> #include<iostream.h> #include<complex.h> void main() { int x1,y1,x2,y2,i,len,gdriver=DETECT,gmode,errorcode; float incx,incy,x,y; initgraph(&gdriver,&gmode,"c:\\tc\\bgi"); clrscr(); cout << "enter the value of x1,y1,x2,y2"<< endl; cin >>x1>>y1>>x2>>y2; len=abs(x2-x1); if(abs(y2-y1)>len) len=abs(y2-y1); incx=(x2-x1)/len; incy=(y2-y1)/len; x=x1+0.5;y=y1+0.5; for(i=1;i<=len;i++) { putpixel(x,y,9); x=x+incx; y=y+incy; } getch(); } |

### Blog post

Article from my blog

## Recent Comments