|
CPP Program For Blinking Lights In Various Rates and Colors |
# include
# include
# include
# include
# include
# include
int poly[8],toggle=1,z;
void blink(int fuzzy[],int size,int lazy,int paint)
{
for(int i=0;i";
cin>>ch;
switch(ch)
{
case 1:
cout<<"\nchoose type of blink rate: very slow/slow/fast/very fast(enter1/2/3/4)--->";
cin>>ch;
if(ch==1)
lazy=1000;
if(ch==2)
lazy=600;
if(ch==3)
lazy=100;
if(ch==4)
lazy=10;
break;
case 2:
cout<<"blink color: random or fixed color ?(enter 1/2)--->";
cin>>paint;
break;
case 3:
cout<<"roughly estimate the no. of blinks per second(multiples of ten,max 50)--->";
cin>>size;
break;
case 4:
lazy=100;
paint=15;
size=20;
break;
case 5:
backend();
exit(0);
}
initgraph(&gd,&gm,"..//bgi");
for(int i=0;i<630;i+=30)
{
for(int j=0;j<470;j+=30)
{ delay(10);
rectangle(i,j,i+30,j+30);
}
}
int fuzzy[50],dummy=0;
while(!kbhit())
{
randomize();
for(i=0;i=15)
i=0;
}
getch();
cleardevice();
closegraph();
}
void backend()
{
int gd=DETECT,gm;
detectgraph(&gd,&gm);
initgraph(&gd,&gm,"c:\tc\bgi");
rectangle(0,5,630,400);
rectangle(12,15,618,390);
settextstyle(1,0,5);
outtextxy(180,60,"THANK YOU");
settextstyle(1,0,3);
outtextxy(160,128,"HOPE U LIKED IT !");
settextstyle(1,0,1);
outtextxy(220,250,"HAVE A NICE DAY !");
int i=0;
while(!kbhit())
{
delay(200);
setfillstyle(XHATCH_FILL,i++);
floodfill(2,9,15);
if(i>=15)
i=0;
}
getch();
closegraph();
}
Sample Output :
CONTROL PANEL
1.Change blink rate
2.Change blink color
3.Specify no. of blinks per second
4.Use default settings and exit
5.Exit simulator
Enter your choice--->
1
choose type of blink rate: very slow/slow/fast/very fast(enter1/2/3/4)--->2
CONTROL PANEL
1.Change blink rate
2.Change blink color
3.Specify no. of blinks per second
4.Use default settings and exit
5.Exit simulator
Enter your choice--->
2
blink color: random or fixed color ?(enter 1/2)--->1
|
|
⇓Student Projects⇓
⇑Student Projects⇑ |