Rolling Circle
      In this program a cirlce is rotating and moving at the same time.The rotation is shown with the help of few lines the are fixed on the centre and rotating.Kbhit is a function that checks for any available keystrokes.
We have used kbhit function to add the functionality of break.
/*
	In this program a cirlce is rotating and moving at the same time.The rotation is shown with the help of
	few lines the are fixed on the centre and rotating.Kbhit is a function that checks for any available 		keystrokes. 
*/
#include<conio.h>
#include<stdio.h>
#include<graphics.h>
#include<dos.h>
#include<math.h>

void main()
{
	int gd=DETECT,gm;
	initgraph(&gd,&gm,"");
	int x=100,y=100,r=20;
	float c=.1;
	for(float i=0;i<100;i=i+.1)
	{
		delay(10);
		cleardevice();
		line(x+i,y,x+i+r*cos(i),y+r*sin(i));
		line(x+i,y,x+i+r*cos(90+i),y+r*sin(90+i));
		line(x+i,y,x+i+r*cos(135+i),y+r*sin(135+i));
		line(x+i,y,x+i+r*cos(180+i),y+r*sin(180+i));
		line(x+i,y,x+i+r*cos(225+i),y+r*sin(225+i));
		line(x+i,y,x+i+r*cos(315+i),y+r*sin(315+i));
		circle(x+i,y,r);
		if(kbhit())
		{
			if(getch())
			{
				printf("break");
				if(getch()){}
			 }

		}

	}
	getch();
}									

Download Program
Did You Know ?
IP address is a numerical label that is assigned to devices participating in a computer network. Read More