line function of C graphic

C program to draw line in C Graphics.

Line function is used to draw line from a point (x1,y1) to a point (x2,y2).It takes 4 arguments. In which First two argument is the starting point of the line on x-axis and y-axis and Last two argument is the ending point of the line on x axis and y-axis.

General syntax of line function is :
                    
                    line( int sx-pos, int sy-pos, int ex-pos, int ey-pos);

                                 By default line function draw line as SOLID_LINE. To set different line style we need to use setlinestyle function of graphics.h before the line function.

C Graphics program to draw line

#include<graphics.h>
#include<conio.h>

main()
{
        int gd = DETECT, gm;

        initgraph(&gd, &gm, "C:\\TC\\BGI");

        line(100, 100, 200, 200);

        getch();
        closegraph();
        return 0;
}



line function of c graphic


Download


0 comments:

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.