Bouncing Ball: #Include #Include #Include #Include
Bouncing Ball: #Include #Include #Include #Include
com
Dipin Krishna
Bouncing Ball
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
void main()
{
int gd = DETECT, gm = DETECT;
int x, y = 0, j, t = 400, c = 1;
initgraph(&gd, &gm, "");
setcolor(RED);
setfillstyle(SOLID_FILL, RED);
for (x = 40; x < 602; x++) {
cleardevice();
circle(x, y, 30);
floodfill(x, y, RED);
delay(40);
if (y
c
t
}
if (y
c
y = y
>= 400) {
= 0;
-= 20;
<= (400 - t))
= 1;
+ (c ? 15 : -15);
}
getch();
}
www.cglabprograms.com
Dipin Krishna