-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBALLCC.C
117 lines (113 loc) · 1.58 KB
/
BALLCC.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#include<stdio.h>
#include<graphics.h>
#include<dos.h>
void main()
{
int gd=DETECT,gm,x,y,x1,y1,ff,yy,flag=0,flag2=0,ch,i;
initgraph(&gd,&gm,"");
x1=getmaxx();
y1=getmaxy();
x=630/2;
y=6;
x1=2;
setcolor(WHITE);
setbkcolor(BLACK);
while(1)
{
setcolor(YELLOW);
rectangle(2,2,638,478);
setcolor(WHITE);
settextstyle(4,0,2);
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(getmaxx()/2,getmaxy()/2,"Designed by : Soumen mukherjee");
i=rand() % 15;
setcolor(i);
circle(x,y,5);
circle(x,y,4);
setcolor(i+1);
circle(x,y,3);
circle(x,y,2);
delay(25);
setcolor(BLACK);
circle(x,y,5);
circle(x,y,4);
circle(x,y,3);
circle(x,y,2);
if((y<476 && flag==0) || y<0 )
y+=x1;
if(y==476 || y>476)
{
flag=1;
sound(4500);
delay(5);
nosound();
}
if((y>6 && flag==1) || y>476)
y-=x1;
if(y==6 || y<6)
{
flag=0;
sound(4500);
delay(5);
nosound();
}
if(flag2==1)
{
x+=x1;
if(x>630)
{
x=629;
flag2=2;
sound(4500);
delay(5);
nosound();
}
}
if(flag2==2)
{
x-=x1;
if(x<5)
{
x=6;
flag2=1;
sound(4500);
delay(5);
nosound();
}
}
if(kbhit())
{
ch=getch();
if(ch==13)
break;
if(ch==77)
{
x+=5;
if(x>630)
x=629;
flag2=1;
}
if(ch==75)
{
x-=5;
if(x==5)
x=6;
flag2=2;
}
if(ch==72)
{
x1+=2;
if(x1==60)
x1=58;
}
if(ch==80)
{
x1-=2;
if(x1==0)
x1=2;
}
}
}
closegraph();
restorecrtmode();
}