##Collision Of two balls In C Graphics
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<dos.h>
int main()
{
int gd=DETECT,gm,i,j,x2=500,x1=100,y=300;
initgraph(&gd,&gm,"c://turboc3//bgi");
for (i=0;x2-x1!=100;i++)
{
setcolor(RED);
circle(x1=100 + i,y=300,50);
delay(50);
circle(x2=500 - i,300,50);
if(x2-x1!=100){
setcolor(BLACK);
circle(x1=100+i,y=300,50);
circle(x2=500-i,y=300,50);
}
}
getch();
closegraph();
return 0;
}
0 Comments