Wall Clock

Write a program to simulate the wall clock.


#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
void main()
{
	int gdriver = DETECT, gmode, errorcode;


	int theta=270,x=0,sec=0,min=1,y=66;
	initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
	while(!kbhit())
	{
		cleardevice();

		circle(350,250,100);
		circle(350,250,101);
		pieslice(350,250,301-y,300-y,60);
		pieslice(350,250,91-x,90-x,90);
		pieslice(350,250,360-theta+1,360-theta,100);
		theta=theta+6;
		setcolor(WHITE);
		if(sec%60==0)
		{
			x=x+6;
			min=min+1;
		}
		sec=sec+1;
		if(min%60==0)
		{
			y=y+6;
		}
		delay(1000);
	}

}


Output
1

Leave a Reply

Your email address will not be published. Required fields are marked *