Posts

Showing posts with the label line

Bresenhams Line Drawing Program in c++

Program to implement Bresenhams Line Drawing Algorithm #include<iostream.h> #include<graphics.h> #include<conio.h> #include<math.h> #include<dos.h> #include<stdlib.h> #include<stdio.h> class lines             {             private:                    int length,x1,y1,x2,y2,x,y,dx,dy,wx,wy,w,width;             public:                   lines();       //Constructor                   void showline();                   int sign(int);             }; int lines::sign(int xx)                         {                         if(xx<0)                         return -1;                         if(xx==0)                         return 0;                         if(xx>0)                         return 1;                         return 0;                         } lines::lines()                         {                         x=0;y=0;                         cout<<"