Bresenham's line drawing algorithm

//Bresenham's line drawing algorithm

void Bres_Line(int,int,int,int);

int main(void)
{
   /* request auto detection */
   int gdriver = DETECT, gmode, errorcode;
   int Xa,Ya,Xb,Yb;

   clrscr();

   cout<<"\nEnter The X-coordinate for first point : ";
   cin>>Xa;

   cout<<"\nEnter The Y-coordinate for first point : ";
   cin>>Ya;

   cout<<"\nEnter The X-coordinate for Second point : ";
   cin>>Xb;

   cout<<"\nEnter The Y-coordinate for Second point : ";
   cin>>Yb;


   /* initialize graphics and local variables */
   initgraph(&gdriver, &gmode, "c:\tc\bgi");

   line((int)getmaxx()/2,0,(int)getmaxx()/2,getmaxy());
   line(0,(int)getmaxy()/2,getmaxx(),(int)getmaxy()/2);

   /* Line Algorithm Call */
   Bres_Line(Xa,Ya,Xb,Yb);

   /* clean up */
   getch();
   closegraph();
   return 0;
}

void Bres_Line(int Xa,int Ya,int Xb,int Yb)
{
    int dx,dy,x,y,Xend,Yend,p;
    float m;

    dx = abs(Xb - Xa);
    dy = abs(Yb - Ya);
    m = dy/dx;
if(dx > dy) //gentle slope
{
    if(Xa > Xb)
    {
        x = Xb;
        y = Yb;
        Xend = Xa;
    }
    else
    {
        x = Xa;
        y = Ya;
        Xend = Xb;
    }
    putpixel(x+getmaxx()/2,getmaxy()/2-y,222);

    p= (2*dy) - dx;

    while( x < Xend )
    {
        x = x + 1;
        if(p < 0)
        {
            p=p+(2*dy);
        }
        else
        {
            if(p>=0)
                if(m>0)
                    y++;
                else
                    y--;

            p=p+(2*(dy-dx));
        }
        putpixel(x+getmaxx()/2,getmaxy()/2-y,222);
        delay(500);
     }
}
else //sharp slope
{

}
}