#include
#include
#include
void rain();
int size=5, speed=100, y=0;
void main()
{
int gdriver=DETECT, gd, i, j, x;
char c;
initgraph(&gdriver, &gd,"");
outtextxy(450,10,"[ 0 ] Stop");
outtextxy(450,20,"[ 1 ] Slow");
outtextxy(450,30,"[ 2 ] Medium");
outtextxy(450,40,"[ 3 ] Fast");
outtextxy(400,450,"Developed by Kailas, S7 CS, MCET");
while(1)
{
if(kbhit()) //to detect whether there is any key stroke
{
c=getch();
if(c=='0') // if key pressed is x or X then exit
{
exit(0);
}
else if(c=='1') // Low speed
speed=500;
else if(c=='2') // medium speed
speed=100;
else if(c=='3') // maximum speed
speed=1;
}
setcolor(0);
rain();
if(y==400)
y=400;
y=y+2;
setcolor(15);
rain();
delay(speed);
}
}
void rain()
{
int i,j;
for(j=0;j<1000;j=j+20)
{
for(i=10;i<640;i=i+10)
{ //printf("%d",i);
line(i,y-j,i,y+size-j);
}
}
/*
setcolor(15);
for(j=20;j<500;j=j+40)
{
for(i=10;i<640;i=i+20)
{ //printf("%d",i);
line(i,j,i,j+size);
}
}
delay(speed);
y=y+5;
setcolor(15);
for(j=0;j<500;j=j+40)
{
for(i=0;i<640;i=i+20)
{
line(i,j,i,j+size);
}
}
setcolor(0);
for(j=20;j<500;j=j+40)
{
for(i=10;i<640;i=i+20)
{
line(i,j-10,i,j+size);
}
} */
}
No comments:
Post a Comment