/* programe  Bresenham's Line- Drawing Algorithm for |m| <1 */
 
#include<stdio.h>
#include<graphis.h>

void lineBres(int xa,int ya,int xb,int yb)
{
int dx=abs(xa-xb),dy=abs(ya-yb);
int p=2*dy-dx;
int twoDy=2*dy,twoDyDx=2*(dy-dx);
int x,y,xEnd;
int driver,mode;

driver=DETECT;
mode=0;
initgraph(&driver,&mode,"");

/*Determine which point to use as start,which as end */

void main(){
int x1,y1,x2,y2;
char c;
do{
  clrscr();
  printf("Enter Coordinate of Start Point of Line at x1,y1 :");
  scanf("%d,%d",&yl);
 printf("Enter Coordinate of End Point of Line at x2,y2");    scanf("%d,%d",&x2,&y2);
clrscr();
lineBres(x1,y1,x2,y2);
printf("Enter New Line (Y/N):");
c=toupper(getch());
}
while(c!='N');
}