Program to make screen saver in that display different size circles filled with different colors and at random places.

 

Program to make screen saver in that display different size circles filled with different colors and at random places.


  1. #include<stdio.h>  
  2. #include<conio.h>  
  3. #include"graphics.h"  
  4. #include"stdlib.h"  
  5. void main()  
  6. {  
  7.     intgd=DETECT,gm,i=0,x,xx,y,yy,r;  
  8.     //Initializes the graphics system  
  9.     initgraph(&gd,&gm,"c:\\tc\\bgi");  
  10.     x=getmaxx();  
  11.     y=getmaxy();  
  12.     while(!kbhit())  
  13.     {  
  14.         i++;  
  15.       //    setfillstyle(random(i),random(30));  
  16.   
  17.         circle(xx=random(x),yy=random(y),random(30));  
  18.         setfillstyle(random(i),random(30));  
  19.         floodfill(xx,yy,getmaxcolor());  
  20.         delay(200);  
  21.     }  
  22.     getch();  
  23. }  

Output

Computer Graphics Programs

Post a Comment

Previous Post Next Post