C program to demonstrate put pixel

Complete C program to demonstrate put pixel

# include<graphics.h> 
# include<conio.h> 
# include <stdlib.h> 
# include<dos.h> 
void main() 
{ 
int gm, gd=DETECT,I; 
initgraph(&gd, &gm,’’’’); 
while(!kbhit())/* until pressing any key this loop continues */ 
{ 
putpixel(rand()%getmaxx(), rand() % getmaxy(), rand()%16); 
/*x and y co-ordinates and the color are taken randomly*/ 
delay(2); /* just to draw the pixels slowly*/ 
} 
getch (); 
closegraph(); /* closes the graph mode */ 
}

Leave a Comment