Creating Random Lines on the Display Screen using Computer Graphics.

Code

# include <graphics.h>
# include <conio.h>
# include <iostream.h>
void get_driver()
{
    int gDriver=DETECT,gMode;  // define variables
    initgraph(&gDriver,&gMode,"c:\\tc\\bgi");  // initialize graphics Library
}
void main()
{
get_driver();
line(0,0,400,50);
outtextxy(10,60,"lets see the magic");
getch();
while(!kbhit())
{
setcolor(random(MAXCOLORS));
line(320,240,random(640),random(480));
delay(500);
}
getch();
closegraph();
}

OUTPUT

Random Lines
Random Lines

 

(Visited 2,202 times, 1 visits today)
Share with Friends :
Written by:

2 thoughts on “Random Lines In Computer Graphics.

  • 31/07/2018 at 3:33 pm
    Permalink

    Great article, very useful !!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *