Rolling Circle

Description:           This program creates a graphic in which one circle (small) is rolling on the surface of other circle(large).

Primary Inputs:    —–
Primary Output:    small circle rolling on the circumference of large circle
Platform Used:      Turbo C++ version 3.0, Borland International Inc.


#include #include #include
#define ROUND(a) (int)(a+0.5)

void main()
int i,ang;
float xr,yr;
int gd=DETECT,gm,errorcode;
initgraph(&gd, &gm, "c:\\tc\\bgi");
errorcode = graphresult();
if(errorcode != grOk)
printf("Graphics Error : %s\n",grapherrormsg(errorcode));
printf("Press any key to continue......");

for(i=0;i<=360;i++) { circle(250,250,100); xr=375; yr=250; xr=250+130*sin(i*3.14/180); yr=250-130*cos(i*3.14/180); //ROUND(xr); //ROUND(yr ); circle(xr,yr,30); delay(10); clearviewport(); } } getch(); }


Rolling Circle
Rate this post

Leave a Reply